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 4017482
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:51:59+00:00 2026-05-20T09:51:59+00:00

My usual workflow when working with git, is something like this: create a local

  • 0

My usual workflow when working with git, is something like this:

  1. create a local repository
  2. do some work in that repository, add/change files etc.
  3. decide that I want a central remote location for the repository, and create one
  4. push all the commits from my local repository to this new remote repository

Now, however, I want to be able to push and pull from this remote repository without having to specify where I’m pushing to or pulling from; I want my local master to track the remote master.

The proper way to do this isn’t clear to me, and I’ve been unable to determine it from the documentation, even though it shouldn’t really be more than one command.

Because it’s something that’s only ever done once per repository, I’ve generally employed one of two simple, but hacky, solutions:

  1. used git clone to make a new local repository, and deleted the old one. After git cloning, the new repository is setup to track the origin.
  2. manually edited .git/config to make master track origin.

I think I should be able to run a command, probably some form of git remote to setup an existing repository to have master track a remote master. Can anyone tell me what that command is?

  • 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-20T09:52:00+00:00Added an answer on May 20, 2026 at 9:52 am

    Use the set-upstream arg:

    git branch --set-upstream local-branch-name origin/remote-branch-name
    

    Running the above command updates your .git/config file correctly and even verifies with this output:

    “Branch local-branch-name set up to track remote branch remote-branch-name from origin.”

    EDIT: As martijn said: “In version Git v1.8.0, –set-upstream is deprecated. Use –set-upstream-to instead.”

    git branch --set-upstream-to local-branch-name origin/remote-branch-name
    

    See this for more information.

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

Sidebar

Related Questions

My usual workflow with git is to create a new feature branch, do some
My usual workflow when starting a git bisect session is: git bisect start #
I use git for my local work (and love it ever so much), and
The usual way I do form handling is like this: contact = Contact( name=form.cleaned_data['name'],
As usual, some background information first: Database A (Access database) - Holds a table
We have the usual web.xml for our web application which includes some jsp and
Any idea regarding the usual storage capacity of a magnetic swipe card ( like
I'm not looking for the usual answer like Web-services. I'm looking for a light
I have a shop system that integrates PayPal in the usual way, i.e. the
I’m trying to find some objective comparisons of Captaris and K2 workflow products. I

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.