Create new branch based on previous commit

Discover the simple steps to creating a new branch in Git, based on a specific previous commit.

git checkout -b new_branch_name
git reset --hard <old_commit_id>

How to use

Test 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.