Friday, April 11, 2014

Git Pull from a different branch on Git

When you create a repository on Github, you check code in and out of the Master branch by default.  Usually, when deploying to production server, the application is built from the master branch and you don't wan't anyone to mess with production code.  So creating a separate branch on the same repository would be the way to go if you want to check in code without affecting the master branch.

To create a new branch on Github do the following steps:

1.  On the branch drop down, type a name for the new branch to create.  Try the name "dev".
2.  On the terminal, type 'sudo git pull'.  This will inform you that a new branch "dev" is available.
3.  Type 'sudo git checkout dev'
4.  Now you can do a 'sudo git pull' to get get code from the dev branch.

It's that easy!

No comments:

Post a Comment