1

I'm trying to push a bug fix to the pandas github repository. Before pushing I had to perform the following commands to make sure my master branch is updated:

# go to the master branch
git checkout master
# pull changes from github
git fetch upstream
# update the master branch
git rebase upstream/master
# push it to your Github repo
git push

Then, I update the local branch:

# go to the feature branch
git checkout my-new-feature
# make a backup in case you mess up
git branch tmp my-new-feature
# rebase on master
git rebase master

git rebase master failed because there are conflicts to solve. To solve them, I'm using git mergetool, which I've associated with Meld, an open source tool to display LOCAL (left), BASE (middle) and REMOTE (right) files.

Code present in the LOCAL file but not the REMOTE

In this case I have some code in the LOCAL file which is not present in the remote. I didn't add that code, so I'm assuming the code has been removed by a merge upstream, while I was working on my local branch. I would therefore opt for removing the code from my LOCAL, in order to have LOCAL, BASE and REMOTE aligned.

REMOTE and BASE diverge

Now, what about the picture above? Last time I tried to take the changes from the REMOTE file, but when I've pushed my change on GitHub, it looked like I the added white-spaces were not from the remote, but I added them. Am I misunderstanding what REMOTE, LOCAL and BASE means?

To me REMOTE is the upstream version, LOCAL the local file I'm working on and BASE a partial merge git was able to carry over, but requires some manual intervention to complete.

How do you perform manual merges? I would take everything from the REMOTE but the changes I personally made.

What makes me doubt about my initial understanding of what LOCAL and REMOTE are, is the following picture.

enter image description here

I wrote the code highlighted in the right hand side

- ``concat`` will now use existing Series names if provided (:issue:`10698`).

  .. ipython:: python

     foo = pd.Series([1,2], name='foo')
     bar = pd.Series([1,2])
     baz = pd.Series([4,5])

  Previous Behavior:

  .. code-block:: python

     In [1] pd.concat([foo, bar, baz], 1)
     Out[1]:
           0  1  2
        0  1  1  4
        1  2  2  5

  New Behavior:

  .. ipython:: python

    pd.concat([foo, bar, baz], 1)

So why is that in the REMOTE and not in the LOCAL? I would expect it to be in the LOCAL file and not in the REMOTE, considering that hasn't been merged yet upstream.

Gianluca
  • 6,307
  • 19
  • 44
  • 65

1 Answers1

1

As I mentioned in "git rebase, keeping track of 'local' and 'remote'"

git checkout A
git rebase   B    # rebase A on top of B

You have:

  • local is B,
  • remote is A

(ours and theirs are reversed during a rebase)

So, 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.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250