Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 617303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:25:17+00:00 2026-05-13T18:25:17+00:00

I know how to make a new branch that tracks remote branches, but how

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:25:17+00:00Added an answer on May 13, 2026 at 6:25 pm

    Given a branch foo and a remote upstream:

    As of Git 1.8.0:

    git branch -u upstream/foo
    

    Or, if local branch foo is not the current branch:

    git branch -u upstream/foo foo
    

    Or, if you like to type longer commands, these are equivalent to the above two:

    git branch --set-upstream-to=upstream/foo
    
    git branch --set-upstream-to=upstream/foo foo
    

    As of Git 1.7.0 (before 1.8.0):

    git branch --set-upstream foo upstream/foo
    

    Notes:

    • All of the above commands will cause local branch foo to track remote branch foo from remote upstream.
    • The old (1.7.x) syntax is deprecated in favor of the new (1.8+) syntax. The new syntax is intended to be more intuitive and easier to remember.
    • Defining an upstream branch will fail when run against newly-created remotes that have not already been fetched. In that case, run git fetch upstream beforehand.

    See also: Why do I need to do `–set-upstream` all the time?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that I can make a setter that checks to see if a
I know I can programatically make the taskbar item for a particular window start
We all know that deadlines and/or critical bugfixes and make us forget a bit
I know I'm gonna get down votes, but I have to make sure if
How can I make a SQL Compact 2008 application for the desktop? I know
I know you could make a helper pretty easily given the data. So, if
does anybody know how to make a numericupdown control for asp. There's one for
I would like to know how to make use of an Axiom database resource
Do you know any easy or simple way to make a map object (from
Does anybody know if there is a way to make autocompletion work in MySQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.