I accidentally amended my previous commit. The commit should have been separate to keep history of the changes I made to a particular file.
Is there a way to undo that last commit? If I do something like git reset --hard HEAD^
, the first commit also is undone.
(I have not yet pushed to any remote directories)
git log --reflog -p -- {{name-of-the-dir-or-file-in-question}}
. It shows both the actual changes and the commit messages for each action.