tayagc.blogg.se

Git rename local branch
Git rename local branch





git rename local branch

* wip_feature_auth_module -> wip_feature_auth_moduleįrom the output of the command, we can see that the test branch has been deleted and a new branch has been created to match the new local branch.

git rename local branch git rename local branch

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 If we want to rename it to reflect the change we made by renaming the local branch, we need to use the git push command, specifiying the old branch name and the new: git push origin :"test" "wip_feature_auth_module" We can confirm this by listing the remote git branches: git branch -rĪs you can see, the test branch is present. Now, it’s important to be aware that the change we have made by renaming the git branch, has only applied to the local git branch. To confirm, list the local git branches using the git branch command: git branch The local git branch has now been renamed. Next, rename the local branch using the git branch -m command: git branch -m wip_feature_auth_moduleĪnd that’s it. To begin, checkout the branch that needs to be renamed: git checkout test

#Git rename local branch code

In this example we have a branch called test which we would like to rename to something more suitable, such as wip_feature_auth_module, which better describes the purpose of the branch and the code updates it contains. There could be any number of reasons why the branch name needs to be changed, but often this comes about because the scope of the change being made to the code has changed, and therefore the git branch name should be updated to best reflect the reason for the branches existance.įortunately, git makes it easy for us to change a branch name! Let’s take a look at an example. When working with git it is sometimes necessary to rename a git branch.







Git rename local branch