简体   繁体   English

在更改日志的合并期间从所有先前提交中收集提交消息

[英]Collect commit messages from all previous commits during merge for changelog

I have a main branch and a feature branch.我有一个主分支和一个功能分支。 The feature branch is several commits ahead of the main branch, and I'd like to merge the feature branch into the main branch.功能分支在主分支之前有几次提交,我想将功能分支合并到主分支中。 I don't intend to --squash and I don't want to rebase because I like preserving the history.我不打算--squash并且我不想rebase因为我喜欢保留历史。

I like to summarize what changed in the merge's commit message because the feature branch history can get convoluted, and a good starting point for me is to copy & edit all of the commit messages from the feature branch's assorted commits since the last merge .我喜欢总结合并提交消息中的更改,因为功能分支历史记录可能会变得复杂,对我来说一个好的起点是复制和编辑自上次合并以来功能分支的各种提交中的所有提交消息。

I vaguely remember reading somewhere that git can compile these messages for me, but I don't remember where I read that or how to do it.我依稀记得在某个地方读到 git 可以为我编译这些消息,但我不记得我在哪里读到的或如何做的。

Apologies if this is a duplicate, but several Google and SO searches have failed to bring this up.如果这是重复的,请道歉,但几次 Google 和 SO 搜索都没有提出这一点。

Edit: Essentially what I'm trying to do is build a changelog for everything that changed between releases.编辑:基本上我要做的是为发布之间更改的所有内容构建更改日志。

I vaguely remember reading somewhere that git can compile these messages for me我依稀记得在某处读到 git 可以为我编译这些消息

Maybe through git rebase , as shown here : don't go through the rebase (cancel it), but copy-paste the aggregated commit messages subjects shown during the rebase.也许通过git rebase ,如下所示:不要通过 rebase(取消它),而是复制粘贴 rebase 期间显示的聚合提交消息主题。

Otherwise, you could not those messages manually (as described here ).否则,您无法手动处理这些消息(如此处所述)。

Or use a tool like antham/chyle to fetch those commit messages from your history.或者使用像antham/chyle这样的工具从您的历史记录中获取这些提交消息。

A一种

git log --oneline HEAD ^master

will create an output like this in git rebase -i master .将在git rebase -i master创建这样的输出。

Perhaps pipe through | cat也许管道通过| cat | cat to remove the colored annotations. | cat删除彩色注释。

The --log parameter for merge is what you are looking for:合并--log参数是您要查找的内容:

  --log[=<n>], --no-log
       In addition to branch names, populate the log message with one-line
       descriptions from at most <n> actual commits that are being merged.
       See also git-fmt-merge-msg(1).

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM