Alex Rivera | Logout

How to branch from a previous commit

Asked 2010-05-12T07:21:55.753
2742

If I have an n number of commits, how can I create a branch from the n-3 commit?

Edit
Report

1 Answer

3

I was able to do it like so:

git branch new_branch_name `git log -n 1 --skip 3 --format=%H`

Where you must enter the skip value. 0 is the latest, 1 is the previous, 2 is the commit before that, etc.

answered 2013-01-31T21:36:23.210

Your Answer