1

I have the following situation. A few days ago I had a commit which was the latest in the HEAD/MASTER.

I came back to work a couple of days later and my commit wasn't there anymore. It looks like someone removed my commit and did some funky. Having a look at the revision history in tortoise GIT it seems to show this but I need some help with the explanation.

Could someone please have a look at the revision history and tell me how someone might have removed my commit? In the history below I am "Richard Riviere" and I have placed an arrow where it seems to show something committing ober my commit. What is the bracket over a range of commits?

enter image description here

thanks

Richie
  • 4,989
  • 24
  • 90
  • 177
  • 1
    Not familiar with that client, but it looks like a branch and then a merge back into master branch. – Christopher Marshall Jul 04 '14 at 04:24
  • It looks like you had a fast-forward merge update after pulling master. Navigate to the specific commit that you're interested in and do a `git show `. It *should* still be there so long as you didn't have major merge conflicts. – Makoto Jul 04 '14 at 04:25
  • So is the commit you're looking for on the screenshot? – zerkms Jul 04 '14 at 04:26
  • @Makoto: if it was FF - there wouldn't be a merge. By definition. – zerkms Jul 04 '14 at 04:27
  • 2
    As @ChristopherMarshall says. The commit currently marked as `master` (Merge branch 'master'...) should include both your changes (Trading hour updates) and cramadhe's (pingable code stuff). Your code did not disappear (since you were the one that is shown as responsible for the merge), your commit did not disappear, they are both in the current `master`'s history. – Amadan Jul 04 '14 at 04:32
  • I was responsible for the merge? Was that because I did a pull and not a fetch? – Richie Jul 06 '14 at 07:01
  • Yes; pull = fetch + merge. – Amadan Jul 07 '14 at 01:24

1 Answers1

1

cramadhe pushed a branch on origin/master, a branch started from just before your commit.

You just pulled from origin/master, merging it with your own local master branch: this wasn't a fast-forward merge, but a classic merge between two branches.

It is possible that your changes have been impacted by what has just been merged locally.

If you just did merge, you can review the differences between your file before and after the merge, using ORIG_HEAD:

git diff ORIG_HEAD HEAD -- yourfile
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I did a pull which I believe does a merge. So how did that branch get created on top of the origin/master. I thought origin/master was a branch in itself? It's dangerous because that person has overwritten my changes – Richie Jul 06 '14 at 06:58
  • @Richie what you see is the result of the merge between `master` and `origin/master`, resulting in a new commit (on `master`) with two parents (one your previous `master` commit, the other being `origin/master`). That happens when you do some local work while others are pushing to the remote: when you are pulling, you are merging those `origin/master` commits pushed in the meantime. That can result in local work being affected (but never lost: it is after all a version control system: you can diff and restore files). Pushing more often can mitigate that risk. – VonC Jul 06 '14 at 07:47
  • Thanks. That's a very good explanation. I think in the future I won't do a pull. I think it should be a fetch. – Richie Jul 08 '14 at 23:15