Create new branch based on previous commit

By Hunter Becton on January 18, 2023

git checkout -b new_branch_name

git reset --hard <old_commit_id>

How to use

Sometimes you may want to revert back to a previous commit because you made changes you no longer want. You can use git log to get a list of your previous commits. Replace the <old_commit_id> with one you want to revert back.