Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to do the following thing in git:

  1. Go back a few commits (master branch)
  2. Create a new branch
  3. Restore the latest commit on the master branch (go forward)

The order is not important, it could be done like:

  1. Create a new branch and switch to it
  2. Go back a few commits (erase them from the branch history)

How can I do this?

share|improve this question
up vote 9 down vote accepted

I'm not sure i understand. What's wrong with:

git branch newbranch $ID_OF_BRANCH_POINT


share|improve this answer
Nothing, it's actually exactly what I was looking for, I just didn't know it was there. Thanks. – Felix Jul 13 '11 at 11:52
Aha! Glad to be of assistance. – Tom Anderson Jul 13 '11 at 12:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .