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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:54:20+00:00 2026-05-15T06:54:20+00:00

When doing a git rebase , I often have difficulty working out what is

  • 0

When doing a git rebase, I often have difficulty working out what is happening with the ‘local’ and ‘remote’ when resolving conflicts. I sometimes have the impression that they swap sides from one commit to the next.

This is probably (definitely) because I still don’t properly understand the paradigm.

When rebasing, who is ‘local’ and who is ‘remote’?

(I use P4Merge for resolving conflicts.)

  • 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-15T06:54:22+00:00Added an answer on May 15, 2026 at 6:54 am

    TL;DR;

    To summarize (As Benubird comments), when:

    git checkout A
    git rebase   B    # rebase A on top of B
    
    • local is B (rebase onto),
    • remote is A

    And:

    git checkout A
    git merge    B    # merge B into A
    
    • local is A (merge into),
    • remote is B

    A rebase switches ours (current branch before rebase starts) and theirs (the branch on top of which you want to rebase).


    kutschkem points out that, in a GUI mergetool context:

    • local references the partially rebased commits: “ours” (the upstream branch)
    • remote refers to the incoming changes: “theirs” – the current branch before the rebase.

    See illustrations in the last part of this answer.


    Inversion when rebase

    The confusion might be related to the inversion of ours and theirs during a rebase.
    (relevant extracts)

    git rebase man page:

    Note that a rebase merge works by replaying each commit from the working branch on top of the <upstream> branch.

    Because of this, when a merge conflict happens:

    • the side reported as ‘ours‘ is the so-far rebased series, starting with <upstream>,
    • and ‘theirs‘ is the working branch.
      In other words, the sides are swapped.

    Inversion illustrated

    On a merge

    x--x--x--x--x(*) <- current branch B ('*'=HEAD)
        \
         \
          \--y--y--y <- other branch to merge
    

    , we don’t change the current branch ‘B’, so what we have is still what we were working on (and we merge from another branch)

    x--x--x--x--x---------o(*)  MERGE, still on branch B
        \       ^        /
         \     ours     /
          \            /
           --y--y--y--/  
                   ^
                  their
    

    On a rebase:

    But on a rebase, we switch side because the first thing a rebase does is to checkout the upstream branch! (to replay the current commits on top of it)

    x--x--x--x--x(*) <- current branch B
        \
         \
          \--y--y--y <- upstream branch
    

    A git rebase upstream will first change HEAD of B to the upstream branch HEAD (hence the switch of ‘ours’ and ‘theirs’ compared to the previous “current” working branch.)

    x--x--x--x--x <- former "current" branch, new "theirs"
        \
         \
          \--y--y--y(*) <- upstream branch with B reset on it,  
                           new "ours", to replay x's on it
    

    , and then the rebase will replay ‘their’ commits on the new ‘our’ B branch:

    x--x..x..x..x <- old "theirs" commits, now "ghosts", available through reflogs
        \
         \
          \--y--y--y--x'--x'--x'(*) <-  branch B with HEAD updated ("ours")
                   ^
                   |
            upstream branch
    

    Note: the “upstream” notion is the referential set of data (a all repo or, like here, a branch, which can be a local branch) from which data are read or to which new data are added/created.


    ‘local‘ and ‘remote‘ vs. ‘mine‘ and ‘theirs‘

    Pandawood adds in the comments:

    For me, the question still remains, which is “local” and who is “remote” (since the terms “ours” and “theirs” are not used when rebasing in git, referring to them just seems to make an answer more confusing).

    GUI git mergetool

    kutschkem adds, and rightly so:

    When resolving conflicts, git will say something like:

    local: modified file and remote: modified file. 
    

    I am quite sure the question aims at the definition of local and remote at this point. At that point, it seems to me from my experience that:

    • local references the partially rebased commits: “ours” (the upstream branch)
    • remote refers to the incoming changes: “theirs” – the current branch before the rebase.

    git mergetool does indeed mention ‘local’ and ‘remote’:

    Merging:
    f.txt
    
    Normal merge conflict for 'f.txt':
      {local}: modified file
      {remote}: modified file
    Hit return to start merge resolution tool (kdiff3):
    

    For instance, KDiff3 would display the merge resolution like so:

    kdiff3

    And meld would display it too:

    Meld diff

    Same for VimDiff, which displays:

    Invoke Vimdiff as a mergetool with git mergetool -t gvimdiff. Recent versions of Git invoke Vimdiff with the following window layout:

    +--------------------------------+
    | LOCAL  |     BASE     | REMOTE |
    +--------------------------------+
    |             MERGED             |
    +--------------------------------+
    
    • LOCAL:
      A temporary file containing the contents of the file on the current branch.
    • BASE:
      A temporary file containing the common base for the merge.
    • REMOTE:
      A temporary file containing the contents of the file to be merged.
    • MERGED:
      The file containing the conflict markers.

    Git has performed as much automatic conflict resolution as possible and the state of this file is a combination of both LOCAL and REMOTE with conflict markers surrounding anything that Git could not resolve itself.
    The mergetool should write the result of the resolution to this file.

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

Sidebar

Ask A Question

Stats

  • Questions 412k
  • Answers 412k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer SimpleAdapter does not know how to deal with a ProgressBar.… May 15, 2026 at 8:07 am
  • Editorial Team
    Editorial Team added an answer Variables such as HTTP_GET_VARS are called long-arrays, and are deprecated… May 15, 2026 at 8:07 am
  • Editorial Team
    Editorial Team added an answer even if the insertion/committing is not successful, the sequence doesn't… May 15, 2026 at 8:07 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.