If I simply do "checkout some_commit" it will switch me to this commit. But what I need is to stay on the current branch (master to be specific) and totally replace all files in it with files from some_commit. How can I do that?
Go back to the selected commit on your local environmentUse git checkout & the ID (in the same way you would checkout a branch) to go back: $ git checkout <commit-id> .
In order to create a Git branch from a commit, use the “git checkout” command with the “-b” option and specify the branch name as well as the commit to create your branch from. Alternatively, you can use the “git branch” command with the branch name and the commit SHA for the new branch.
git reset --hard <commit>
(I'm sure this is a duplicate, but don't have time to search.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With