Git – setup tracking properly

OK, there are a number of ways to setup tracking remote branches with git. We need that so we can use push and pull commands without long explaining what to push/pull where… I’d say that normally all we mortals need is to assume that the remote branch will be called the same as the local one, so with this assumption it really can be all easy and clean.

So we have 2 cases:

  1. Push new local branch to remote, and setup tracking:
    git push -u origin branchname
  2. Pull new remote branch, and setup tracking
    git checkout -b branchname --track origin/branchname
This entry was posted in Software Development, Tools and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *