On Thu, May 07, 2009 at 11:07:31PM -0700, James wrote:
> Dear all,
> I have two branches in my git repository:
>  master
> *branch1
> Both branches have commits. Now I hope my branch1 becomes master, and
> master becomes "branch2". Which command shall I input? Thanks a lot!

There's no need to jump through hoops renaming branches in git.
You are probably better off using merge.

It sounds to me (and correct me if I'm wrong) that you have work
in branch1 that you want in master.  In git the answer is
simple.  Merge branch1 into master.

        $ git checkout master
        $ git merge branch1

You can delete branch1 now because master is a superset of

        $ git branch -d branch1

When you have new topics to work on start all over again...

        $ git checkout -b branch2

Renaming your master branch is not a very typical thing to do
in git which is why I responded.

Hope that helps,



You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to