Thursday, 10 January 2013

How to rename your local branch name in Git

Suppose if you are planning to rename your local git branch after sometime checkout. The following command will be useful. For example if you checkout previously "master" branch now you decided want to rename your local branch name than do this

git branch -m master working_copy
Immediately your local branch name is renamed into "working_copy".

NOTE: If you edited,added some files in "working_copy" branch and than you did commit those changes and than if you try to push into master do the following command.
 git push origin working_copy:master

If you do "git push origin working_copy" means it will create a new branch "working_copy" in remote repository with your recent changes(not pushed into Master branch).

Tips: git remote origin show - this command will tell you what are the local branches  linked into which branches in remote repository. It will show the permission on push,pull, merge command specific.

No comments :

Post a Comment