how to correctly remove a restarted branch (the original bit) for bitbucket synchronization?

StackOverflow https://stackoverflow.com/questions/23592945

  •  20-07-2023
  •  | 
  •  

Question

Summary: how to synchronize bitbucket with my local repo after having stripped a changeset locally from a branch which has been restarted?

Details:

My code in Mercurial has a default branch with the stable version. I create named branches to do some tests, eventually merging them into default if the changes are fine.

I created at some point a short-lived extratemp branch (one commit) which I abandoned. Later on I recreated a new branch also named extratemp. When committing, Tortoise Hg asked me if I wanted to "restart" the branch and I said yes (which was probably a bad idea).

I then decided to strip the old, short-lived, extratemp branch with hg strip -r 126 (where 126 was the short-lived changeset). So far so good, I now have the following view of the branches:

enter image description here

I then pushed to bitbucket and since it was reluctant :) I did a hg push --new-branch --force. Its view of the commits is the following:

enter image description here

As you can see it retained the bit I stripped (commit 5ac3e1b). If I now pull I get it back:

enter image description here

What can I do to force bitbucket to be synchronized with my local repo so that the original extratemp is not retained?

Was it helpful?

Solution

A strip cannot be synchronized, since it is the absence of a changeset. The original commit has been made public already, and it exists everywhere it has been pulled. Even if you remove it from the main repo, it may get pushed back again by another, eventually. If you want to remove it from the other repositories, you will have to strip it manually everywhere.

While this may be possible if the repo is private and if you control who has access to it, it can be harder for public repos. The best alternative is to leave the changeset while rendering it inactive.

To do so, simply merge the two heads of extratemp on your local repo, by following these instructions to the letter. Then, your branch should only have one head, with your current state.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top