Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. git branch myNewBranch # Create local branch named "myNewBranch"
  2.  
  3. git push -u origin myNewBranch # Pushes your newly created local branch "myNewBranch"
  4. # to the remote "origin".
  5. # So now a new branch named "myNewBranch is
  6. # created on the remote machine named "origin"
  7.  
  8. git pull origin myNewBranch # Pulls new commits from branch "myNewBranch"
  9. # on remote "origin" into remote tracking
  10. # branch on your machine "origin/myNewBranch".
  11. # Here "origin/myNewBranch" is your copy of
  12. # "master" on "origin"
  13.  
  14. git checkout myNewBranch # Switch to myNewBranch
  15. git pull # Updates remote tracking branch "origin/myNewBranch"
  16. # to be in sync with the remote branch "myNewBranch"
  17. # on "origin".
  18. # Pulls these new commits from "origin/myNewBranch"
  19. # to local branch "myNewBranch which you just switched to.
  20.  
  21. $ git remote
  22. bitbucket
  23. origin
  24.  
  25. $ git remote -v
  26. bitbucket git@bitbucket.org:flimm/example.git (fetch)
  27. bitbucket git@bitbucket.org:flimm/example.git (push)
  28. origin git@github.com:Flimm/example.git (fetch)
  29. origin git@github.com:Flimm/example.git (push)
  30.  
  31. $ ls -F .git/refs/remotes/
  32. bitbucket/ origin/
  33.  
  34. $ git branch
  35. master
  36. new-feature
  37.  
  38. $ ls -F .git/refs/heads/
  39. master new-feature
  40.  
  41. $ git branch -vv
  42. master b31f87c85 [origin/master] Example commit message
  43. new-feature b760e04ed Another example commit message
  44.  
  45. $ git checkout new-feature
  46. $ git pull
  47. There is no tracking information for the current branch.
  48. Please specify which branch you want to merge with.
  49. See git-pull(1) for details
  50.  
  51. git pull <remote> <branch>
  52.  
  53. If you wish to set tracking information for this branch you can do so with:
  54.  
  55. git branch --set-upstream new-feature <remote>/<branch>
  56.  
  57. $ git branch -r
  58. bitbucket/master
  59. origin/master
  60. origin/new-branch
  61.  
  62. $ tree -F .git/refs/remotes/
  63. .git/refs/remotes/
  64. ├── bitbucket/
  65. │   └── master
  66. └── origin/
  67. ├── master
  68. └── new-branch
  69.  
  70. $ git remote show origin
  71. * remote origin
  72. Fetch URL: git@github.com:Flimm/example.git
  73. Push URL: git@github.com:Flimm/example.git
  74. HEAD branch: master
  75. Remote branches:
  76. io-socket-ip new (next fetch will store in remotes/origin)
  77. master tracked
  78. new-branch tracked
  79. Local ref configured for 'git pull':
  80. master merges with remote master
  81. new-branch merges with remote new-branch
  82. Local ref configured for 'git push':
  83. master pushes to master (up to date)
  84. new-branch pushes to new-branch (fast-forwardable)
  85.  
  86. git branch -d <branchname>
  87.  
  88. git branch -D <branchname>
  89.  
  90. git branch -rd <remote>/<branchname>
  91.  
  92. git branch <branchname> [<start-point>]
  93.  
  94. git branch --track <branchname> [<start-point]
  95.  
  96. git branch --track hello-kitty origin/hello-kitty
  97.  
  98. git push --delete <remote> <branchname>
  99.  
  100. git remote prune <remote>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement