-2

Any chance to undo any of the following lines:

git rm cvs
git rm cvs -r
git reset HEAD --.
git reset --hard HEAD
git reset --hard
git clean -df
git status
git rm --cached .
git rm --cached
git rm --cached -r
git rm --cached -r --ignore-unmatch
git rm --cached -r --ignore-unmatch .
Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
David
  • 1
  • 1
  • Are you trying to undo a specific commit from the latest? – Rod Argumedo Mar 19 '16 at 18:05
  • I think git clean -df removed some of the important files. Im not sure. – David Mar 19 '16 at 18:09
  • `git clean` will remove files that are *not* stored in git, so unless you have backups, let it go 'cause they're gone, man. If you have removed files that were actually stored in your git repository, then it is usually possible to retrieve them from an earlier commit. – larsks Mar 19 '16 at 18:18
  • All the information you need is here: http://stackoverflow.com/questions/34519665/how-to-move-head-back-to-a-previous-location/34519716#34519716 Read about the reflog and you use it to revert to your desired point in time. – CodeWizard Mar 19 '16 at 18:36

1 Answers1

0

To undo a specific commit from the last known good commit, first look at the git log and you should see this in the shell:

commit: your40characterSHA1codehere # copy this into the clipboard
Author: your name here with email address
date: date-here

Commit message here

You should copy the commit sha1 code, then perform git reset --hard your40characterSHA1codehere and git push origin master --force to force push the master or other branches you worked on. Hope this helps!

Rod Argumedo
  • 610
  • 11
  • 29