简体   繁体   English

Visual Studio 中的默认 Git 提交消息

[英]Default Git Commit Messages in Visual Studio

I'm looking to solve a problem with our CI build definition being triggered by merge commits.我希望解决由合并提交触发的 CI 构建定义的问题。 I'd like to find where Visual Studio stores the default merge commit message and edit it to include the ***NO_CI*** hack.我想找到 Visual Studio 存储默认合并提交消息的位置并编辑它以包含***NO_CI*** hack。 So far I haven't found any reference to where the default commit message values are stored.到目前为止,我还没有找到任何关于默认提交消息值存储位置的参考。 I dug through the settings in the IDE and there aren't any that look like commit messages.我仔细研究了 IDE 中的设置,但没有任何看起来像提交消息的内容。 Does anyone know where they're hidden?有谁知道他们藏在哪里?

Also, I've seen the related questions here on Stack but most are talking about cygwin and command line git usage, not the integrated Team Explorer panel in VS.另外,我在 Stack 上看到了相关问题,但大多数都在谈论 cygwin 和命令行 git 用法,而不是 VS 中的集成团队资源管理器面板。

If recent Visual Studio does not use libgit2 anymore , then it should be using Git directly.如果最近的 Visual Studio 不再使用 libgit2 ,那么它应该直接使用 Git。

If you can, do a git config -l --show-origin (soon git config -l --show-origin --show-scope with git 2.26 to see all settings.如果可以,请执行git config -l --show-origin (很快git config -l --show-origin --show-scope与 git 2.26以查看所有设置。

Look for a commit.xxx setting, like for instance commit.template .查找commit.xxx设置,例如commit.template

If this is done by a CI, create a CI job which will do a git config -l --show-origin如果这是由 CI 完成的,请创建一个 CI 作业,该作业将执行git config -l --show-origin

That should show you the setting which allows said CI to use the right commit message.这应该向您显示允许所述 CI 使用正确提交消息的设置。

This is a workaround这是一种解决方法

You can run bash or a PowerShell to check if the last commit contains a certain word.您可以运行 bash 或 PowerShell 来检查最后一次提交是否包含某个单词。 (I'm using bash here) (我在这里使用 bash)

git log head -1 | grep -q 'Merge:'

Run it as a part of the pipeline, set a variable which can be used to validate as a part of a condition.作为管道的一部分运行它,设置一个变量,该变量可用于作为条件的一部分进行验证。

git log head -1 | grep -q 'Merge:' && _stop_pipeline=true

Use a condition for the stage or the step:使用舞台或步骤的条件:

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

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