1

I am working with the GitHub GUI on Windows.

I did some work on my project which was successfully committed about a month ago going forward. Unfortunately other person who also works on this project recently committed the files I changed without realizing that he removed a huge portion of my work.

Now my question would be: is there an easy way of restoring my commits. This is not one commit. For the past month I made several very important commits to the project which got killed by the other party error.

I really don't want to go thru each file individually and re-aaply the changes manually, especially since I already got paid for that work.

How can I get my commits back?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Igor
  • 5,620
  • 11
  • 51
  • 103

1 Answers1

1

IF you don't see your commit anymore in the history of the repo, that would mean the other developer has done a forced push (git push --force).

In that case, use git reflog (as in this answer) to find your commits back.

If yo do see your commits, then you could revert (git revert) the commits introduced by the other developers in order to cancel them, which should leave your branch in a state reflecting your work.

In both cases, this is a communication issue: you need to coordinate with the other developer in order for both of you to agree on a state from which to move forward.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you. I was afraid to hear that responce. Yes, I do see my commits in the log, but there are lots and lots of different commits that our boss and he did in between. I guess the only meaningful answer would be to ask him nicely to put all this back before going any further. – Igor Apr 26 '14 at 06:25
  • @Igor true, but you can revert multiple commits in one command though: http://stackoverflow.com/a/4992711/6309 – VonC Apr 26 '14 at 07:20