gitmergeresetundo

Undo "git reset --merge"


I just did:

git reset --merge

and I lost my latest modifications to some files, how do I undo this last action?


Solution

  • you can look at your reflog to find the commit at wich you were before:

    git reflog
    

    Once you find your previous commit, copy the sha-1 hash and

    git reset <commit sha-1> --hard
    

    Although, if what you lose was uncommitted modifications, well then they're lost.