You may learn more about getting the SHA1 here. However, if you cleared the screen or restarted the Git Bash then this code won’t be visible. The SHA1 code mentioned above can be found immediately after you removed a branch and want to recover the branch. This command should create the branch from the same point where this was removed. (The SHA1 7f5faa4 will vary, so take the code from your Git Bash). The SHA1 code can be seen as you deleted a file (see picture below): ![]() hello-git-branch.įor recovering a branch, you need SHA1. Suppose we want to recover the same branch as I deleted in above section i.e. If you accidentally removed a branch or just testing and want to undo the branch removal operation then this section describes how you may do this. $ branch -d hello-git-branch How to undo removal operation of a branch? If this branch has an upstream branch then execute these two commands:Īnd finally, for deleting the hello-git-branch with –d flag, execute these two commands: To merge this branch, run this command after checking out into master branch i.e.: Suppose, our branch name that is not fully merged is hello-git-branch. How to fully merge the branch?īefore running the command with -d flag, you may use this command for fully merging with upstream branch: If you are want to remove this even branch is not fully merged then use the -D flag which is the alias for force delete i.e. Then you may delete this by -D flag as shown below:Īs such, -d flag is the alias for –delete, it requires you to fully merge the branch to be deleted to its upstream branch. ![]() The command for removing this branch:Įrror: The branch “tst-br” is not fully merged … Suppose, the branch name we want to delete is tst-br. The command for removing a branch locally: First, let us have a look at the general way of deleting branches both locally and remotely. In this tutorial, I will explain how to remove Git branches locally as well as in the remote server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |