Branch from a previous commit using Git


If I have N commits, how do I branch from the N-3 commit?


Create the branch using a commit hash:

git branch branch_name <commit-hash>

Or by using a symbolic reference:

git branch branch_name HEAD~3

To checkout the branch while creating it, use:

git checkout -b branch_name <commit-hash or HEAD~3>

What is HEAD in Git?

How do I update the password for Git?