I accidentally use revert instead of reset uncommitted files. What should I do now? I am still new to git. Now I was forced to commit the revert.
Asked
Active
Viewed 57 times
0
-
_"Now I was forced to commit the revert."_ - no you weren't, you can still reset to an earlier commit. – CodeCaster Apr 18 '19 at 08:50
-
6Possible duplicate of [How do I "un-revert" a reverted Git commit?](https://stackoverflow.com/questions/8728093/how-do-i-un-revert-a-reverted-git-commit) – Esteban Garcia Apr 18 '19 at 08:50
-
I have commited the revert -.- how do i proceed from here? – Claude Apr 18 '19 at 08:53
-
I've deleted some files and would like to get them back. is it possible with git reset? $ git reset HEAD Unstaged changes after reset: D config-overrides.js M package-lock.json M package.json this is what i get – Claude Apr 18 '19 at 09:01
-
AFAIK, uncommitted files aren't recoverable if you overwrote them using git (like checkout, reset, etc) – evolutionxbox Apr 18 '19 at 09:12
-
If you are using IntelliJ or something similar and hadn't restarted the program, you might still have the files in your local history. – mgershen Apr 18 '19 at 12:38
-
If the state you want back exists in a commit, use `git log` to find the sha1 you want, then `git reset --hard sha1` will bring your back there. Warning: this will destroy any uncommitted changes in your sandbox, so only do this if you really want to go back to the exact state described by that sha1. – joanis Apr 18 '19 at 13:20