在将提交消息发送到 git-svn 中的 SVN 之前,我可以在提交消息中添加一个字符串吗?
我的组织有一些愚蠢的要求,您必须在每个 SVN 提交消息的末尾添加“admin”,以便绕过 SVN 看门人做出的某些决定,即每个提交都应该有一个关联的错误号。 (团队中的每个人都类似地绕过了这个要求。)
我正在尝试使用 git SVN,但我想避免在频繁的 git-svn 提交末尾添加“admin”。
有没有办法让 git SVN 为我做这件事?
My org has some silly requirements that you must put "admin" at the end of every SVN commit message in order to get around some decision made by the SVN gatekeepers that every commit should have an associated bug number. (Everyone on the team bypasses this requirement similarly.)
I'm trying to use git SVN, but I'd like to avoid putting "admin" at the end of my frequent git-svn commits.
Is there a way to have git SVN do this for me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以设置一个 git commit hook,这样当你提交到 git 时,它会将
"admin"
附加到提交消息中。然后,当您执行 git svn dcommit 时,您的提交消息将已经包含预期的字符串。有关 git hook 的文档。
在项目的
.git
目录中,会有一个名为hooks
的目录。您可以查看这些文件,
prepare-commit-message.sample
可用于在提交之前编辑提交消息。复制
prepare-commit-message.sample
并将其命名为prepare-commit-message
。因此,打开该文件,作为演示,我将这一行添加到末尾:
保存更改,退出,尝试更改,然后提交。
You can set up a git commit hook, so that when you commit to git, it will append
"admin"
to the commit message. Then when you do yourgit svn dcommit
, your commit messages will already have the expected string there.Documentation on git hooks.
In your project's
.git
directory, there will be a directory calledhooks
.You can take a look at the files,
prepare-commit-message.sample
can be used to edit commit messages before they are committed.Make a copy of
prepare-commit-message.sample
and call itprepare-commit-message
.So open that file, and as a demonstration I added this line to the end:
Save changes, exit, try a change, and commit it.
有几个想法,但每个都需要一些工作:
A couple ideas, but each require a little work: