Thread (7 messages) flat view 7 messages, 5 authors, 2016-06-15

Re: question about a merge result

From: Michael Gaber <hidden>
Date: 2016-06-15 22:46:41

Francis Moreau schrieb:
Hello,

I'm a little bit confused about a merge I have done and the result
suprised me. Thinking about it I'm still not convinced what should be
the result.

Here's the use case:

$ mkdir test-git && cd test-git
$ date > A
$ date > B
$ git init
$ git add .
$ git commit -m "Init"

So far I just created a repo with 2 files A and B

$ git branch b1
$ git rm B
$ git commit -m "remove B"

Now I created a branch 'b1' and remove B file in master branch

$ git checkout b1
$ git rm B
$ git commit -m "remove B"
$ git revert HEAD

Now on 'b1' I did the same as master but I thought that removing B was
a bad idea so I revert the previous commit

$ git checkout master
$ git pull . b1
$ ls B
ls: cannot access B: No such file or directory

So merging 'b1' into master removed the B file even if in branch 'b1'
I restored it.

Could anybody explain me why this is the correct behaviour and why not
file 'B' is not restored as it was done in branch 'b1' ?

thanks
well, I'd say the thing is, that in b1 there is no change at all to the
tree anymore, so when applied to master (without B) there is no b restored

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help