Git – Create a new master

git

I have imported my svn repository to git. My current branch for development is branch1 and I would like to rename the one in master. Can I remove current master branch(with very old info) painless and create a new remote branch from branch1 with name master?

Thanks in advance!

Best Solution

If you no longer need the information in master, you could easily get rid of it:

git branch -D master

Once master is gone, you could rename branch1 to be the new master:

git branch -m branch1 master

If you are a bit uncertain whether you might need the information held in master one day, you could achieve this by renaming master to old_master before renaming branch1 to master:

git branch -m master old_master
git branch -m branch1 master