Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
After switching to a different branch, git checkout - can move me back to the branch I came from. This is handy for times when I wonder "wait, what was that last branch again?" But this does not w...
Question
git
#1: Initial revision
How can I git checkout the previous HEAD?
After switching to a different branch, `git checkout -` can move me back to the branch I came from. This is handy for times when I wonder "wait, what was that last branch again?" But this does not work for everything situation when you switch from commit to another. It works for branches, but when you do `git pull` and receive some new commits, `git checkout` won't switch you back to the previous one. Is there a command for "switch back to the previous commit I was on" that works in every situation that changes HEAD?