Jump to content

How to undo multiple changesets on main branch after mistakes?


Xarbrough

Recommended Posts

Shortly before our last milestone delivery, we basically screwed up our project and committed it multiple times to the main branch. Normally, we would have used a task-branch and then would have simply abandoned it, but in this case, due to last-minute stress, our developers thought they could all fix it on main, so we ended up with this:

image.png.9d2025b36e780855dbe128feed000d43.png

Everything marked in red should be discarded (the entire changesets only contain follow-up on an earlier mistake). Due to panic-mode, we branched-off the earlier changeset where everything was still working and continued with a few working changes on the Milestone 02 branch. This milestone branch I would like to merge to main but without the changesets marked in red. I would also like to include the changeset on main right after the split into the other branch.

What is the cleanest way of fixing this? I know about subtractive merge for a single changeset, but wouldn't I have to do it 6 times to remove all the red changesets here?

 

Link to comment
Share on other sites

After digging around on the forum for a bit, I found the following thread which seems to contain my answer: 

 

There, manu explains how to use "Subtractive merge from this changeset interval", which does what I need. I read about subtractive merge on the blog and on one of the documentation pages, but there the interval option was not mentioned, so I didn't know about it.

After testing it on a dummy repository, I used it on our real repo and it worked great!

PS: Maybe I'm failing at googling and reading the docs, but I still can't find the official documentation where it says that subtractive merge works on an interval, maybe that's something to add.

Link to comment
Share on other sites

Hi,

 

Glad you could do it! Subtractive interval was the best option there, yes. Other option was to delete the changests if you didn't want to keep the history, but we do not recommend it.

Quote

PS: Maybe I'm failing at googling and reading the docs, but I still can't find the official documentation where it says that subtractive merge works on an interval, maybe that's something to add.

I'll share it with the team, because if it was hard to find for you, it will probably be hard for the rest of our users.

 

Best regards and thank you for the feedback,

Héber.

Link to comment
Share on other sites

Sure!

At first I searched for "Plastic SCM delete changeset" and similar things like "undo changeset" and quickly found this page: http://blog.plasticscm.com/2014/07/how-to-undo-merge.html

There I learned about the subtractive merge feature, but it did not mention that I could apply it to a changeset interval on the blog.

So, I continued the search for "Plastic SCM subtractive merge" and found this page via google: https://www.plasticscm.com/documentation/advanced-version-control-guide#subtractive-merge

I read over the entire page and then re-read the section "Subtractive Merge" a few times. It explained nicely how to remove a single changeset, however I did not initially understand that I could apply this to an interval. Now, that I know about the feature it also seems obvious, because the previous section is "Interval Merge". However, as a beginner, the term "interval merge" did not sound like something I would need and I failed to make the connection that the interval can probably be used for most other operations. Maybe it could be made more clear with a small cross reference such as "to apply subtractive merge to a range of changesets see the section about interval merge" or something like that.

I did not find any other pages about these features.

Link to comment
Share on other sites

  • 2 years later...

Just found this thread. I was having the same issue and will try what Xarbrough used. I too skipped over the "interval Merge" Note the documentation really should have a section on "How to revert/undo multiple changesets" 

I appreciate this forum. But the documentation should have covered this. It might also talk about subtractive merge versus delete multiple changesets as well.

I would normally just delete the bad sets that didn't work, (not a simple changesets but an integration of whole new SDK, lots of changes we decided we don't want at all) but I already have a merge from them to main I want to preserve.

Wish there were an obvious way to take everything past a certain changeset and make that into a new branch, perserving links to anything that came off of it. Then the original branch would keep its name.

I see how to make a new branch at the last good spot, but it will then have a new name. I want to maintain the branch's name that was being used originally for new work (sans the changesets we are abandoning for now). 

In effect I am asking is there a way to rename branches? Keep their GUID but rename them?

And update I found rename! It is in the branch submenu. Ok I can simply make a new branch and name it as the old one. Renaming the old one first of course!

 

Edited by Scott Adams
Answered my won question about rename
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...