

When you want to commit something in your branch, be sure to be in your branch. Push the branch on github : $ git push origin $ git pullĬreate the branch on your local machine and switch in this branch : $ git checkout -b When you create a new branch, it will include all commits. The following commands do the same thing: Two-step method git branch NEW-BRANCH-NAME git checkout NEW-BRANCH-NAME Shortcut git checkout -b NEW-BRANCH-NAME. You can pass the -b option (for branch) with git checkout. When you do a pull request on a branch, you can continue to work on another branch and make another pull request on this other branch.īefore creating a new branch, pull the changes from upstream. There’s a shortcut to create and checkout a new branch at once.
Each time that you want to commit a bug or a feature, you need to create a branch for it, which will be a copy of your master branch. If youre working on a new feature, or pushing a bug fix to your site, branching is a great way to ensure you dont cause any issues with your main version. git branch git checkoutIn your Github fork, you need to keep your master branch clean, by clean I mean without any changes, like that you can create at any time a branch from your master.
