Search code examples
gitintellij-ideaterminal

Git undo command: "git reset --hard"


Im working on a Java project in intelliJ. I typed in the following command: "git reset --hard" in the terminal. How do I undo this command? Before this command I didnt commit anything. Is everything lost now?


Solution

  • There is 3 possibilities:

    PS: But don't forget one of the most important rule when using git "Commit everything and often (and especially before doing things you don't master). You will always be able to retrieve your changes/commits (at least using the reflog)"