How do you usually comment your merges in mercurial (solo developer, only one external repo in bitbucket)?
When I have to commit merges I've done in mercurial, I just do hg commit -m "Merge."
What do you usually do when Merging? Do you write the changesets in a comment, or try to write "meaningfull" comments (since I think they are useless, except when you're doing merges from two really different repos in different locations).
Is it possible to create an alias in mercurial (like hgmerge) in [alias] in hgrc, that automatically does hg commit -m "Merge:开发者_如何学Python heads ${head}, ${head} ..."
?
It would be easy to create that alias (I'll do it below) but it's also of almost no value. It's very easy to pull the parent1 and parent2 values out of a merge changeset, so it's not really telling you anything more than just "merge" would.
Personally, even on single person repos I try to put something at least halfway useful even if it's just something like these:
- merging configuration work into code
- merging work from desktop into work from laptop
- merging away an anonymous branch I didn't like
- forgot to pull/update before editing
There's always some reason history diverged, even if it's a totally mundane reason like forgetting to update or working disconnected at the coffeeshop, and that's what I note.
That said you could do this:
hg commit -m "merging: $(hg parents --template '{node|short}\n') | xargs"
which you sould make a shell alias with:
[aliases]
mycommit = !$HG hg commit -m "merging: $(hg parents --template '{node|short}\n') | xargs"
Allowing you to run hg mycommit
, but just dig for the better description.
P.S. Someone is going to suggest the fetch
extension. Ignore them.
When I'm merging after a pull, I usually only write something like "merge after pull". When I must correct something after the merge, I'll precisely describe what I did so my coworkers can understand the changes.
When I'm merging a branch in another, I precise the two branches on the commit message "merging branch1 in branch2".
As for the alias, sorry, I have no idea.
精彩评论