0

I was working in branch otherIssue. I do some work in file foo.bar and some other files. I commit it to d379865.

Then checkout to branch issue, merge otherIssue to issue and push to upstreap.

After that dev1 do some work on his local issue in other files without changing foo.bar. (commit 4fb65b2). And merge upstream's issue to his issue. After that my changes disappeared.

I don't see any changes in foo.bar using git show c1c25b5 and git show 4fb65b2.

My graph:

* |   c1c25b5 - (9 hours ago) NO CHANGES Merge branch 'issue' of repo:project into issue - dev1
|\ \  
| * | 4c95813 - (14 hours ago) MY CHANGES IS STILL HERE - dev2
| * |   a08ccdb - (14 hours ago) Merge branch 'otherIssue' into issue - dev2
| |\ \  
| | |/  
| | * d379865 - (14 hours ago) otherIssue: MY CHANGES IS HERE - dev2
| | * 521d54d - (19 hours ago) otherIssue: some changes - dev2
* | | 4fb65b2 - (11 hours ago) issue: somechanges - dev1
|/ /  
* | b3baeed - (19 hours ago) issue: - dev1

I can restore changes without problems, but I can't understand how could this happen?


$ MERGE_COMMIT=c1c25b5
$ BRANCH_ONE=c1c25b5^1
$ BRANCH_TWO=c1c25b5^2
$ COMMON_ANCESTOR=b3baeed
$ FILE_WITH_MISSING="path/to/foo.bar"

$ git show $MERGE_COMMIT | grep $FILE_WITH_MISSING | wc -l
  0 # Why??
$ git diff $MERGE_COMMIT..$COMMON_ANCESTOR -- $FILE_WITH_MISSING | wc -l
  0
$ git diff $BRANCH_ONE..$COMMON_ANCESTOR -- $FILE_WITH_MISSING | wc -l
  0
$ git diff $BRANCH_TWO..$COMMON_ANCESTOR -- $FILE_WITH_MISSING | wc -l
  210
$ 
$ git log -p $COMMON_ANCESTOR..$BRANCH_ONE | grep "$FILE_WITH_MISSING" | wc -l
  0
$ git log -p $COMMON_ANCESTOR..$BRANCH_TWO | grep "$FILE_WITH_MISSING" | wc -l
  3
$ 

There are question "Git; code disappeared after merge", but there are no explanation of this incident.

Community
  • 1
  • 1
Tarwirdur Turon
  • 751
  • 5
  • 17
  • What exactly do you mean by "checkout to branch issue, merge otherIssue to origin/issue."? `issue` isn't the same branch as `origin/issue`! merging `issue` and `otherIssue` doesn't automatically merge the upstream branch. – joker Jun 21 '16 at 13:17
  • @joker yes, I understand. It was pushed to upstream after merge. I suppose that there was push after each commit. – Tarwirdur Turon Jun 21 '16 at 13:51

0 Answers0