Go back in time and create branch

branchgit

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?

Best Answer

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

git branch newbranch $ID_OF_BRANCH_POINT

?

Related Question