Create and track a remote branch in Git


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # Create the remote branch
  2.  
  3. git push origin origin:refs/heads/some_branch
  4.  
  5. # Make sure everything is up-to-date
  6.  
  7. git fetch origin
  8.  
  9. # Then you can see that the branch is created.
  10.  
  11. git branch -r
  12.  
  13. # This should show ‘origin/new_feature_name’
  14. # Start tracking the new branch
  15.  
  16. git checkout --track -b new_feature_name origin/some_branch
  17.  
  18. # This means that when you do pulls that it will get the latest from that branch as well.
  19. # Make sure everything is up-to-date
  20.  
  21. git pull

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.