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?
1 Answer
git reset --hard <commit>
(I'm sure this is a duplicate, but don't have time to search.)
-
Be sure to do this after making current the branch you want to replace Commented Jun 5, 2021 at 22:22
-
How to create a new commit when this happens? Like StackExchange edits, "Rollback to sha"– minseongCommented Apr 5, 2022 at 23:49