2021年1月27日星期三

How to get back to the latest commit after checking out a previous commit? (When the branch name is unknown.)

I made several commits before I discovered a bug that happened somewhere within the new commits. In order to pinpoint which commit introduced the bug, I checked out several different commits and manually tested each. I am now ready to checkout the latest commit and make my fixes. However, I cannot run git checkout - because I have checked out more than one sha. And I cannot remember the branch name. (I have several branches with similar names.) I also do not want to use cherry-pick because there are code changes that must remain in the bug-introducing commit.

How do I checkout the latest commit on the current branch, without knowing the branch name, after checking out more than one previous commit?

https://stackoverflow.com/questions/65929880/how-to-get-back-to-the-latest-commit-after-checking-out-a-previous-commit-when January 28, 2021 at 09:45AM

没有评论:

发表评论