Problem with git merge/rebase with conflicts
From: Eli Barzilay <hidden>
Date: 2016-06-15 22:48:45
I'm writing about merging and rebasing with conflicts, and there's
something weird with it -- after this setup:
mkdir /tmp/r1; cd /tmp/r1; git init
echo foo > file; git add file; git commit -m first
cd /tmp; git clone r1 r2
cd /tmp/r1; echo abc > file; git commit -m abc file
cd /tmp/r2; echo xyz > file; git commit -m xyz file
git fetch
1. I get this:
$ git merge origin
...CONFLICT...
$ git status -s
UU file
$ echo xyz > file
$ git add file
$ git status -s
and there's nothing -- it's all clean after that `add', without
committing and without anything said. If this is intentional, it
would be nice if there was some message from `git add'... And it
would also be nice if I'd seen it mentioned anywhere, but
practically everything I've read said the same: `git add' and then
`git commit', no mention of that second step being optional.
2. I have some other sample repository that exhibits the behavior with
the "resolution" going the other way, but here -- starting from the
same setup:
$ git merge origin
...CONFLICT...
$ echo abc > file
$ git add file
$ git status -s
M file
$ git commit
...get an editor without the conflict resolution template thing...
$ git log --graph --all --oneline
* 2d3744b Huh?
* 98c46da xyz
| * 4744b19 abc
|/
* c8915c2 first
This looks like I never did any merge.
$ git merge origin
Merge made by recursive.
$ git log --graph --all --oneline
* 94e69e9 Merge remote branch 'origin'
|\
| * 4744b19 abc
* | 2d3744b Huh?
* | 98c46da xyz
|/
* c8915c2 first
And this looks even more wrong...
3. Again, starting from the same setup:
$ git rebase origin
...CONFLICT...
$ git status -s
UU file
$ echo abc > file
$ git add file
$ git status -s
<- nothing
$ git rebase --continue
Applying: xyz
No changes - did you forget to use 'git add'?
which is probably related to the above. I could use --skip, but
now that I edited it manually I can't remember that --skip does
what I already did.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!