First checkout the branch you want to branch from.
$ git checkout master
Make sure ever thing is updated (fix any problems that might happen here).
$ git pull
Check you are in the right branch (note the asterisks).
$ git branch
* masterCreate new local branch
staging
$ git branch new-feature
Checkout the new branch
$ git checkout new-feature
Double check you are in the right branch and the remote branches are good
$ git branch -a
Push local branch to create remote branch* new-featuremasterstagingorigin/HEADorigin/masterorigin/staging
$ git push origin new-feature
Triple check your branches to make sure everything shows up as expected.
$ git branch -a
* new-featuremasterstagingorigin/HEADorigin/masterorigin/new-featureorigin/staging
Other developers who might also want to use the new branch can now easily do so. If they do git branch -a the new branch will show up on the list as a remote branch. If they want to actively work with the branch they need to check it out to their local machine.
$ git checkout -tb new-feature origin/new-feature
No comments:
Post a Comment