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

  • SEARCH
  • Home
  • 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 8156263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:53:50+00:00 2026-06-06T16:53:50+00:00

I have a local branch named ‘ my_local_branch ‘, which tracks a remote branch

  • 0

I have a local branch named ‘my_local_branch‘, which tracks a remote branch origin/my_remote_branch.

Now, the remote branch has been updated, and I am on the ‘my_local_branch‘ and want to pull in those changes. Should I just do:

git pull origin my_remote_branch:my_local_branch

Is this the correct 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-06-06T16:53:52+00:00Added an answer on June 6, 2026 at 4:53 pm

    You have set the upstream of that branch

    (see:

    • "How do you make an existing git branch track a remote branch?" and
    • "Git: Why do I need to do --set-upstream-to all the time?"
      )
    git branch -f --track my_local_branch origin/my_remote_branch
    # OR (if my_local_branch is currently checked out):
    $ git branch --set-upstream-to my_local_branch origin/my_remote_branch
    

    (git branch -f --track won’t work if the branch is checked out: use the second command git branch --set-upstream-to instead, or you would get "fatal: Cannot force update the current branch.")

    That means your branch is already configured with:

    branch.my_local_branch.remote origin
    branch.my_local_branch.merge my_remote_branch
    

    Git already has all the necessary information.
    In that case:

    # if you weren't already on my_local_branch branch:
    git checkout my_local_branch 
    # then:
    git pull
    

    is enough.


    If you hadn’t establish that upstream branch relationship when it came to push your ‘my_local_branch‘, then a simple git push -u origin my_local_branch:my_remote_branch would have been enough to push and set the upstream branch.
    After that, for the subsequent pulls/pushes, git pull or git push would, again, have been enough.

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

Sidebar

Related Questions

I have a local topic branch that's tracking a remote branch. For the sake
I have already got a local master branch tracking the remote master branch of
I have a remote tracking branch tracked locally in my local repository using 'git
I have a local branch that is tracking of a remote branch on git.
I have a local branch which is a new branch called A . I
This is not Find out which remote branch a local branch is tracking ,
I needed to have a local branch pulling and pushing to a remote branch
Say you have a branch on your origin that has a ridiculously long name...
I have a local branch work, where I created two new files a.py, b.py
Lets say I have the following two branches and the local branch is 'mybranch'

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.