Creating a branch from a revision with Git

A very short "memo to self" post to note down how to create a branch using the git command line, from a specific revision:

git checkout -b MyBranchName 22322e768c9956bb93a3701504250124c4d5bf53

This should generate a message of "Switched to a new branch 'MyBranchName'" which means it's all worked! Something that's quite useful if the specific revision you're after doesn't have a tag associated with it. If it does, no need for the hash, just use:

git checkout -b MyBranchName v1.0

Replacing 'v1.0' with the name of the tag you want to branch from. Simples!

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments