How to switch to specific Git commit without losing all the commits made after it?
I want that local files will be changed, but commits\' database w
First, use git log
to see the log, pick the commit you want, note down the sha1 hash that is used to identify the commit. Next, run git checkout hash
. After you are done, git checkout original_branch
. This has the advantage of not moving the HEAD, it simply switches the working copy to a specific commit.