Remove Branches / Merges?

Peter Hosey boredzo at gmail.com
Sun Aug 9 16:50:07 CDT 2009


On Aug 09, 2009, at 05:36:52, Bret Naylor wrote:
> Is there a way to rework a repository via diff, rebase, import etc.  
> in order to go through and rebase branches at their merge point so  
> the end result is a single line of changesets (all branches removed)?

You would probably have to script the rebase command.

But, more importantly, doing this will change the changeset  
identifiers of all the descendants of every merge. Every changeset  
identifier is a hash of several facts, including the identifier(s) of  
the changeset's parent changeset(s).

If you remove a merge, then the next commit after the merge will need  
a new parent, which you'll set to the last changeset before the merge.  
Changing the parent of that first post-merge changeset changes its  
hash, which changes the hash of the next changeset, and so on.

The result is that if anyone pulls from you, they'll receive nearly  
the entire history again, *in addition to* the branchy-mergy history  
that existed before your mass-rebase operation, and if you pull from  
them, you'll receive the branchy-mergy history *in addition to* your  
rebased history. (And, of course, the same applies to pushing, in the  
opposite directions.)

If you're the one and only person working on this project, it's  
probably OK, although you certainly should make a back-up before you  
go munging history like this. If you're not, it's best not to worry  
about it.



More information about the Mercurial mailing list