Domanda

I'm pretty new to Mercurial but it seems that when two commits exist with the same parent it automatically creates a branch, but for some reason it gives them the same name (in SourceTree anyway). This isn't a problem until you have to administer one of the open branches- say for some reason I want to close one- no matter which branch I try to close it always applies the command to the same one. The only way to close the other one is to do it through terminal commands, which is pretty annoying. Am I doing something wrong here in my workflow or is that just a bug in SourceTree?

È stato utile?

Soluzione

In TortoiseHg for Windows it can freely close one or the other or both heads of the same branch. It is important, however, to update to the head you wish to close before issuing the commit. This is what is issued by the UI:

% hg commit --verbose "--message=Close default branch" --close-branch

As an advice, and because it is a better practice, you should use named branches instead of committing multiple heads on the same branch. In fact, pushing multiple heads of the same branch is not recommended, and usually requires a --force option.

In the end, I am sure SourceTree will be more cooperative with named branches anyway...

A good read on the topic can be found here.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top