How do I create a new Git branch from an old commit?

JZ. picture JZ. · Aug 23, 2011 · Viewed 285.2k times · Source

Possible Duplicate / a more recent/less clear question
Branch from a previous commit using Git

I have a Git branch called jzbranch and have an old commit id: a9c146a09505837ec03b.

How do I create a new branch, justin, from the information listed above?

Answer

bdonlan picture bdonlan · Aug 23, 2011
git checkout -b justin a9c146a09505837ec03b

This will create a new branch called 'justin' and check it out.

("check out" means "to switch to the branch")

git branch justin a9c146a09505837ec03b

This just creates the branch without checking it out.