You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Make an existing Git branch track a remote branch?

I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remote branch?

I know I can just edit the .git/config file, but it seems there should be an easier way.

Answer

Cancel
2
  • 1
    @Quincy Check greg's answer - use git push -u origin branch (or --set-upstream-to) instead May 28, 2013 at 8:37
  • 1
    @MadNik, what is the difference between --set-upstream and --track? I don't quite understand why I should use one over the other.
    – Asclepius
    Mar 31, 2014 at 18:30