git checkout branch from commit code example
Example 1: git checkout branch
truelover@PEACE project % git checkout master
truelover@PEACE project % git checkout branch_name
truelover@PEACE project % git checkout -b new_branch_name
Example 2: git branch from commit
You can create the branch via a hash:
git branch branchname <sha1-of-commit>
Or by using a symbolic reference:
git branch branchname HEAD~3
To checkout the branch when creating it, use
git checkout -b branchname <sha1-of-commit or HEAD~3>