Make an existing git branch track a remote

Posted: November 30, 2010. Tags: Git

I find it almost easier to edit .git/config than to remember this command:

git branch --set-upstream foo upstream/foo

From here.

Update: Adding -u to a git push command will accomplish the same thing, e.g.

git push -u origin foo

and this is much easier to remember as you're leveraging your existing knowledge of git push.