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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given a branch
fooand a remoteupstream:As of Git 1.8.0:
Or, if local branch
foois not the current branch:Or, if you like to type longer commands, these are equivalent to the above two:
As of Git 1.7.0 (before 1.8.0):
Notes:
footo track remote branchfoofrom remoteupstream.git fetch upstreambeforehand.See also: Why do I need to do `–set-upstream` all the time?