![]() Share your feedback in the comments section. Renaming a branch whether it is local or remote, it is very easy. You have successfully renamed you local and remote Git branch. git push origin -u new_branch_name Conclusion git push origin -delete to the remote and reset the upstream branch. You do not need to specify the old branch name if you want to rename the branch you are viewing. (use 'git pull' to merge the remote branch into yours) I would like to throw away the 3 local commits, and pull the 8 remote commits at origin/master. This will change the name of the branch you are viewing to the new name you specify. I have the following message in git: Your branch and 'origin/master' have diverged, and have 3 and 8 different commits each, respectively. Delete Old Remote Git BranchĪs i said earlier, to rename the remote git branch, you need to delete remote git branch first. To rename a Git branch, run the following command: git branch -m . This command will rename the currently active git checkout branch. To rename a local branch in git, you can use the git branch command followed by the -m flag and old-branch-name, new-branch-name. Follow the steps below to rename a Local and Remote Git Branch: Start by switching to the local branch which you want to rename: git checkout .Use -m option with git command to rename the local git branch to your desired name. To achieve this, we need to delete the old remote git branch and then push the renamed local branch. Unfortunately, you canât directory rename a remote git branch. Git allows you to rename the branch easily using the -m option. This tutorial will help you to rename local and remote git branch and fix the branch that was named incorrectly and not followed the naming convention of your organization.
0 Comments
Leave a Reply. |