https://www.educative.io/edpresso/how-to-delete-remote-branches-in-git
While working with Git, it is possible that you come across a situation where you want to delete a remote branch. But before jumping into the intricacies of deleting a remote branch, let’s revisit how you would go about deleting a branch in the local repository with Git.
Deleting local branches
- First, we print out all the branches (local as well as remote), using the
git branchcommand with-a(all) flag. - To delete the local branch, just run the
git branchcommand again, this time with the-d(delete) flag, followed by the name of the branch you want to delete (testbranch in this case).
Note: Comments are the output produced as a result of running these
gitcommands
Note: You can also use the
-Dflag which is synonymous with--delete --forceinstead of-d. This will delete the branch regardless of its merge status.
Deleting remote branches
To delete a remote branch, you can’t use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name (origin in this case) after git push.
Không có nhận xét nào:
Đăng nhận xét