Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create a new branch with git and manage branches
- In 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. 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.
- 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.
- Before creating a new branch, pull the changes from upstream, your master needs to be up to date.
- Create the branch on your local machine :
- $ git branch <name_of_your_new_branch>
- Push the branch on github :
- $ git push origin <name_of_your_new_branch>
- Switch to your new branch :
- $ git checkout <name_of_your_new_branch>
- When you want to commit something in your branch, be sure to be in your branch.
- You can see all branches created by using
- $ git branch
- Which will show :
- * about
- master
- master_test
- Add a new remote for your branch :
- $ git remote add <name_of_your_remote> <url>
- Push changes from your commit into your branch :
- $ git push origin <name_of_your_remote>
- Delete a branch on your local filesytem :
- $ git branch -d <name_of_your_new_branch>
- Delete the branch on github :
- $ git push origin :<name_of_your_new_branch>
- The only difference is the : to say delete.
- If you want to change the default branch, navigate to your fork and go into the Admin panel, in the drop-down list simply choose which default branch you want to use.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement