Advertisement
m0gliE

gihub

Apr 5th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.56 KB | None | 0 0
  1. Create a new branch with git and manage branches
  2.  
  3. 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.
  4.  
  5. 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.
  6.  
  7. Before creating a new branch, pull the changes from upstream, your master needs to be up to date.
  8.  
  9. Create the branch on your local machine :
  10.  
  11. $ git branch <name_of_your_new_branch>
  12.  
  13. Push the branch on github :
  14.  
  15. $ git push origin <name_of_your_new_branch>
  16.  
  17. Switch to your new branch :
  18.  
  19. $ git checkout <name_of_your_new_branch>
  20.  
  21. When you want to commit something in your branch, be sure to be in your branch.
  22.  
  23. You can see all branches created by using
  24.  
  25. $ git branch
  26.  
  27. Which will show :
  28.  
  29. * about
  30.   master
  31.   master_test
  32.  
  33. Add a new remote for your branch :
  34.  
  35. $ git remote add <name_of_your_remote> <url>
  36.  
  37. Push changes from your commit into your branch :
  38.  
  39. $ git push origin <name_of_your_remote>
  40.  
  41. Delete a branch on your local filesytem :
  42.  
  43. $ git branch -d <name_of_your_new_branch>
  44.  
  45. Delete the branch on github :
  46.  
  47. $ git push origin :<name_of_your_new_branch>
  48.  
  49. The only difference is the : to say delete.
  50.  
  51. 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