Git recipe: creating a new local branch and getting it pushed to remote repo

April 27th, 2009 by e-thang Leave a reply »

There may be better ways.  “Recipe” implies process given to me, and it gets the job done.  I have better things to do (i.e. projects) than play with SCM.  Azeroth isn’t going to save itself…

1. Create new branch locally

git branch <new branch name> <old branch name>

2. Push new branch to server

git push origin <new branch name>

3. Make sure changes to new local branch go to remote version (unsure if this step is necessary, as I’ve never tested not doing it)

git branch -D <new branch name>

4. Check out the new branch again

git checkout -b <new branch name> –track origin/<new branch name>

Advertisement

Leave a Reply