Jump to content

Move changeset in a different branch.


Marc S

Recommended Posts

Hi everyone.

A common mistake I make is to think I'm on a branch while I'm on an other and checking a changeset. Sadly, there is no feature to fix that.

It's not possible to copy that changeset into a shelve to remake it on the right branch and it's not possible to revert a changeset to local changes.

I had to copy paste my code to the other branch from the diff window before deleting my bad changeset. Not an ideal solution when the initial mistake happen to users who are inexperienced or tired.

 

This would be an easy fix with shelves, copying the changeset into one, committing it on the target branch and deleting the changeset (or if not possible, making a new changeset with the previous data).

 

Thanks in advance.

Link to comment
Share on other sites

  • Marc S changed the title to Move changeset in a different branch.

Under Rightclick=>"Advanced options", there is always the option "Move from this changeset to a different branch...".

You can even move several changesets at once (=fixed range "selected changeset up until the end of the branch"), and even modify changesets in branches that have already been merged back (however, then you are forced to move them to a new branch created at the predecessor of the selected changeset).

Granted, this feature is limited to moving these changesets to an EMPTY branch - but still, it does what you want, and you can then simply merge that new branch into your desired branch.

20 hours ago, Marc S said:

It's not possible to copy that changeset into a shelve to remake it on the right branch and it's not possible to revert a changeset to local changes.

These would both be cool features! Add to that the option that when deleting the changeset I'm currently on, the changes are not lost, but also put back into local/pending changes.

Link to comment
Share on other sites

On 1/18/2023 at 8:43 PM, Marc S said:

or if not possible, making a new changeset with the previous data

Just FYI, this functionality exists, and/but it is called "Subtractive merge", under the "Advanced merge" menu. It reverts changes from a particular changeset (or a range of them). If you do this often, it will clutter your branch explorer with lots of red merge links, though.

  • Like 1
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...