0

Because I was in a hurry for some reason to fix a small little detail in my commit, I directly edited my commit through the site platform which discarded/removed a guy's commit which was committed before my, and I didn't pull because, again, I was in a hurry.How to bring back his lost commit, is it possible?I've researched a bit, didn't find perfect solution, but I decided to ask here first, while I continue searching for answers, thanks.

Also I usually always pull before commiting, I just failed this time :(

  • What do you mean by "directly edited my commit through the site platform"? – Ajedi32 Nov 27 '13 at 18:49
  • I commited my work through the terminal of course, then I went into the repository link directly into my browser, saw the mistake, and edited it right away and commited(now with mistake fixed) FROM the site. – user3043104 Nov 27 '13 at 18:51
  • Clarification needed. What is this "site" where you edited the change? Do you mean github? How did you "edit" your commit on the site (as far as I know, you can only edit files on github and create new commits)? Please state clearly exactly what happened. As it stands, your question is rather confusing. – Noufal Ibrahim Nov 27 '13 at 19:02
  • Yes, I am indeed talking about github.Directly edited the code from the github site, did not undo commit, recommit or anything, that resulted in deleted the exact previous commit done by someone else.It was not big of a fix to use my text editor, I just had to change few characters, so I just clicked on EDIT in the site, and did my job which, again, resulted in destroying/removing/discarding the previous commit made by someone else, I want to find out how can I retrieve back his lost commit.Problem comes from the fact that I did not pull the repository before making the small edit in site. – user3043104 Nov 27 '13 at 19:08
  • Possible duplicate of [Does github keep deleted remote branches in history? If so, can those be restored?](http://stackoverflow.com/questions/4674226/does-github-keep-deleted-remote-branches-in-history-if-so-can-those-be-restore); whether or not the question is a duplicate, if^Wsince OP's using github I'm betting [VonC's answer](http://stackoverflow.com/a/4674485/1290731) is the correct one here too. – jthill Nov 27 '13 at 20:41

1 Answers1

2

The edit button on GitHub does not delete commits. If someone makes a commit between the time you started your edit and the time you commited, you'll get a warning:

Ajedi32 has committed since you started editing. See what changed.

Even if you then ignore that warning and commit anyway, you'll just overwrite the other user's changes with your new commit, not delete their commit.

Check the log; chances are the other guy's commit is still there.

Ajedi32
  • 45,670
  • 22
  • 127
  • 172