Jump to content
Xarbrough

How to undo multiple changesets on main branch after mistakes?

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?

 

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Hi!

Would you mind sharing the terms you used in your search? We want to improve it and see why you couldn't find any proper information.

Best,

Héber.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...