I wanted to undo a commit, using IntelliJ I right-clicked on the last commit and then clicked "Revert Commit". A message told me no changes were made. By looking at the command log the command was:
revert 75d72c1c0746b225d3857 --no-commit The reverted changes appear in the changelist (or in the staged files area using sourcetree). I realized it wasn't the correct command to do what I needed, so I used:
reset --soft HEAD^ The last commit was eliminated, but the edited files did not appear in the changelist. It was as if I executed a reset --hard.
I managed to recover changes in another way, but I don't understand why the soft reset acted as a hard reset.
git init; touch foo; git add foo; git commit -m "add foo"; echo "hello" >> foo; git commit -am "modify foo"; git revert --no-commit HEAD; git reset --soft HEAD~