0

I was actually going to post this on this SO question. Because it's the first one that shows up on Google. But I thought it should be better to post this as new question (SO is not a forum after all).

First I will show you this picture to get an idea of the branches state (obviously real commit messages were replaced for privacy):

commit nightmare

So, after tracking down every commit I've found that the guilty was the last merge made by my coworker (the one on top). Still, I can't figure out how could have gone wrong. All changes in between the large commit and the one with conflicting files were lost.

As you may have noticed, the green line represents my coworker's local branch, the orange/brown is a hotfix branch and the blue is mine.

So, after I resolved the conflicts on cb2ff5f, I merged the hotfix branch changes and then updated the version number on the corresponding files.

Meanwhile, my partner was still working on new changes, so he had his working tree in a dirty state. I notified him that I merged his changes and requested him to pull them. He couldn't do that because some of the dirty files were conflicting with the remote branch (which had my merge). He uses Eclipse EGit extension as a git client. As some of you may know, in this situation Eclipse shows three options: Reset those files (discarding your changes), stash them or commit them. He chose to commit them. That's the commit 3c684e1 (leaving the rest of the files dirty). And then, somehow, the final merge commit discarded all the changes from the commits in the remote branch, including my merge commit.

Is this a bug with Eclipse EGit? I can't think of anything else.

Update: I've found out something interesting. I executed git log -p 3c684e1 12ab983 and git log -p 8095107 12ab983. Both outputs show that the changes of my commits were properly merged. However, when I run git checkout 12ab983... The changes are not there. So, it seems like Git is lying

Update 2: I tried to reproduce the issue. I created a local branch named branch_mine from commit 8095107 and another named branch_other for 137be26 (the large commit from my partner before my conflicts resolution). I re-created what partner did on branch_other. I modified some files leaving the tree in a dirty state. I tried to merge with branch_mine and Eclipse complained because I have modified some files that were conflicting. I committed those files and then tried the merge again. It worked, and without any conflicts. Furthermore, my changes were there on the new merge commit. So it has to be an issue on my partner's end. Just I don't know exactly what and I'm afraid that it may happen again. Could it be a synchronization issue with the filesystem? Also, it's worth to mention that, while he uses EGit as a Git client, he is actually coding in Visual Studio Code. So, maybe there was a synchronization issue between these two, causing a merge commit to actually lie. It's just amazing and terrifying at the same time.

lordscales91
  • 423
  • 1
  • 8
  • 22
  • You can find the [bug tracker for EGit/JGit here (filter for the products _EGit_ and _JGit)](https://bugs.eclipse.org/bugs/query.cgi?classification=Technology&product=EGit&product=JGit). You talk about _"my coworker's local branch"_, so the screenshot shows the history of the local Git repository of your coworker, not your of local repository, right? Did you try to reproduce the problem? – howlger May 11 '18 at 08:57
  • @howlger This is my repo point of view. The green line is more like a path of my coworker's branch that diverged from mine. I didn't tried reproducing the issue yet. But I found out something interesting. I updated the question with the details – lordscales91 May 11 '18 at 09:12
  • Eclipse has its own Git implementation in Java (JGit) whereas Visual Studio Code just delegates to the command line. After using Git outside of Eclipse, you should press the _Refresh_ button in the _Git Staging_ or _Git Repositories_ view. Maybe that was the reason. Do you know what operations your colleague did outside of Eclipse? – howlger May 12 '18 at 13:06
  • @howlger I don't think that's the case. He doesn't use Git in VS at all. Probably he doesn't have installed Git command line tools either. That would explain why he uses Eclipse as a Git client. It's really weird. The only thing I know for sure is that the commit `12ab983` is corrupt somehow – lordscales91 May 13 '18 at 07:32

0 Answers0