Rolling back or re-creating the master branch in git?

Posted by Matthew Savage on Stack Overflow See other posts from Stack Overflow or by Matthew Savage
Published on 2010-04-22T08:32:59Z Indexed on 2010/04/22 8:33 UTC
Read the original article Hit count: 219

Filed under:
|
|

I have a git repo which has a few branches - there's the master branch, which is our stable working version, and then there is a development/staging branch which we're doing new work in.

Unfortunately it would appear that without thinking I was a bit overzealous with rebasing and have pulled all of the staging code into Master over a period of time (about 80 commits... yes, I know, stupid, clumsy, poor code-man-ship etc....).

Due to this it makes it very hard for me to do minor fixes on the current version of our app (a rails application) and push out the changes without also pushing out the 'staged' new features which we don't yet want to release.

I am wondering if it is possible to do the following:

  1. Determine the last 'trunk' commit
  2. Take all commits from that point onward and move them into a separate branch, more or less rolling back the changes
  3. Start using the branches like they were made for.

Unfortunately, though, I'm still continually learning about git, so I'm a bit confused about what to really do here.

Thanks!

© Stack Overflow or respective owner

Related posts about git

Related posts about branch