Hg 合并后提交消息,最佳实践?

发布于 2024-09-28 01:35:20 字数 708 浏览 7 评论 0原文

我发现自己经常做以下事情:

C:\Code>hg pull
pulling from http://server/FogBugz/kiln/Repo/Project/Rebuild/trunk
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 4 changes to 4 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)

C:\Code>hg merge
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, dont forget to commit)

C:\Code>hg commit -m "Merged"

C:\Code>hg push
pushing to http://server/FogBugz/kiln/Repo/Project/Rebuild/trunk
searching for changes
remote: kiln: successfully pushed 2 changesets

我的问题是,在合并来自存储库的拉取后,可以使用什么更好/更有用的提交消息。人们在分布式版本控制系统中是否有针对此类事情使用的最佳实践?

I find myself doing the following a lot:

C:\Code>hg pull
pulling from http://server/FogBugz/kiln/Repo/Project/Rebuild/trunk
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 4 changes to 4 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)

C:\Code>hg merge
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, dont forget to commit)

C:\Code>hg commit -m "Merged"

C:\Code>hg push
pushing to http://server/FogBugz/kiln/Repo/Project/Rebuild/trunk
searching for changes
remote: kiln: successfully pushed 2 changesets

My question is, what is a better/more useful commit message to use after merging a pull from the repository. Are there any best practices that people use in distributed version control systems for this sort of thing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

梦回梦里 2024-10-05 01:35:20

如果您使用提取扩展,它会自动执行拉取、合并步骤到一步、提取。它自动生成的消息类似于“自动合并”。 hg 开发人员似乎认为这是合理的,因为扩展现在与基础一起分发。

合并消息似乎不包含特别大量的信息。你的消息看起来很有道理。

[[题外话,我们有时用它们作为“合并”一词双关语的机会]]

If you use the fetch extension it automates the pull,merge step into one step, fetch. The message it auto-generates is something along the lines of "automatic merge". The hg developers seem to think this is reasonable as the extension is now distributed with the base.

Merge messages don't seem to be contain a particularly high amount of information. Your message seems reasonable.

[[ offtopic, we sometimes use them as an opportunity for a pun on the word merge]]

娇纵 2024-10-05 01:35:20

没有一种方法,所以这就是我试图坚持的方法。

关于提交消息:

请记住,这些消息是唯一可以将您与尝试破译提交原因的人联系起来的字符串。

关键是提供对代码开发有用的描述。
因此,当有人使用 hg log 时,他会对软件的开发方式有一个很好的评论。

一些好的做法:

将其与错误管理系统链接:

  1. 修复#3456、新功能#2435等
  2. ,或者更具描述性的它在存储库中带来的更改之一
  3. 给予积分

事实上,我主要做的就是。看看
“hg log”的当前状态并查看
什么有用的信息意味着
理解最新提交的逻辑进展。

There is no one way so here is what I have tried to adhere to.

On commit messages:

Jus remember that those messages are the only strings that would connect you to some one who is try to decipher the reasons for the commit.

Key is to provide a description that is going to be a useful commentary on code development.
So when some one uses hg log , he has a nice commentary on how the software is being developed.

Some good practices:

Link it with your bug management system:

  1. fixes #3456, new feature #2435 etc
  2. or a more descriptive one of what changes it is bringing in the repo
  3. Give credits

In fact, what I do mostly is. Look at
the current state of "hg log" and see
what useful message would mean a
logical progression in understanding the latest commit.

把梦留给海 2024-10-05 01:35:20

只要消息中以某种方式出现“合并”,我们就会利用这个机会让我们的善变日志充满欢乐。例如,我们使用了诸如“房地产合并贷款处于历史最低水平”或“合并格里芬电视制作”之类的合并消息。

As long as "merg" is in the message somehow, we've had fun using the opportunity to fill our mercurial logs with hilarity. For example, we've used merge messages such as "real-estate mergage loans are at an all time low" or "a Merge Griffin television production."

勿忘初心 2024-10-05 01:35:20

您可以通过手动编辑 commit-message.txt 将所有新添加的变更集的提交消息收集到一个文件中

$ hg log --rev 'reverse(p2():ancestor(p1(),p2())-ancestor(p1(),p2()))' \
         --template '{desc}\n' \
         > commit-message.txt

,最后将其用作日志消息:

$ hg commit -l commit-message.txt

You can collect all the newly added changesets' commit messages into a file by

$ hg log --rev 'reverse(p2():ancestor(p1(),p2())-ancestor(p1(),p2()))' \
         --template '{desc}\n' \
         > commit-message.txt

then manually edit commit-message.txt, and finally use it as the log message:

$ hg commit -l commit-message.txt
东走西顾 2024-10-05 01:35:20

您可以使用 rebase 扩展,因此 hg pull --rebase 会将您的存储库重新设置为中央存储库的提示。这消除了拉取后合并的需要。

我为它添加了一个别名:

[alias]
pure = pull -u --rebase

对我们来说效果很好。

更多详细信息请参见 RebaseProject 页面。

You could use the rebase extension, so hg pull --rebase would rebase your repo to the central repo's tip. This negates the need for merging after a pull.

I added an alias for it:

[alias]
pure = pull -u --rebase

Works well for us.

More details are at the RebaseProject page.

怪我闹别瞎闹 2024-10-05 01:35:20

对于只使用一个存储库的普通合并,我认为“合并”就可以了。通常您甚至不知道合并的所有内容,因为无论如何都是其他人的更改。

有一次我建议更加详细的是当您使用多个存储库时。如果您有一个开发仓库和一个稳定仓库,并且您正在从稳定仓库中提取错误修复,我只会在合并中提到:“与稳定合并”。这些合并往往规模更大,因此有助于向后来的人解释它们。

For mundane merges, where you're only working with one repository, I think just "merge" is fine. Usually you don't even know everything that got merged in because it's all other people's changes anyway.

The one time I would suggest being more verbose would be when you're working with more than one repository. If you have a devel repo and a stable repo, and you're pulling bug fixes in from stable, I would just mention that in the merge: "merging with stable". Those merges tend to be bigger, so it helps explain them to people who come along later.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文