My log looks something like this with the last 2 commits:
commit ABC
TEMP
commit DEF
Working!
Something I did after DEF
broke my code. I didn’t want to lose the changes, so I made a commit named TEMP
. I then did git checkout DEF -f
, then git status
told me HEAD detached at DEF
. When I do a log command, I don’t see my TEMP commit.
What I would like to do is to use git restore
(or another command) to get each modified file from ABC
, one by one until I find the culprit file. Then I’d like to delete or “strip” ABC
. I’m coming from mercurial where you can delete commits. I haven’t pushed to my remote repo, because I don’t want the TEMP/ABC
commit to go the remote repo.
I realize I’m probably doing it “the wrong way”, so how should I handle a situation where I messed something up, and I want to go back to the previous commit but save my changes so I can grab them file by file? I assume there is a better way than creating a TEMP
commit as I did.