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?


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

git branch newbranch $ID_OF_BRANCH_POINT


| 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.