I've got no idea what the Git graph looks like in this instance, so before I accidentally lose any code, I figure I'll ask for help.
I committed some code that broke things, so I checked out a previous commit to look at what went wrong.
commit 87dfs7f6d6fs8 (latest commit on master)
commit 7fe7f86we6f8d6 <-- checked out this guy
However, I forgot to recheckout master
to fix the problem, and instead fixed it in the detached-HEAD state.
So, now, my Git history looks something like this... (I guess)
commit 87dfs7f6d6fs8 (latest commit on master)
|--- commit 6f5dsf5d65f <-- New commit (currently checked out)
commit 7fe7f86we6f8d6 <-- checked out this guy
What I'd like to do is completely get rid of the topmost commit and keep the changes that I made. I think to do this I need to reset --hard
to the commit hash I'm currently on, right?
So, it'd be:
git reset --hard 6f5dsf5d65f
Where commit 6f5dsf5d65f
is the commit I did in the detached-HEAD state. Is this right..?