Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 8 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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