如何在"git-pull"自动合并后更改提交消息? [英] How do I change a commit message after a 'git-pull' auto-merge?

查看:400
本文介绍了如何在"git-pull"自动合并后更改提交消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,当由于git-pull而生成自动合并时,我的协作者会慌张",并且只接受默认的提交消息.在推送此提交之前,我想确保该消息已修复,但是--amend似乎不起作用.解决这种情况下生成的消息的最佳方法是什么.我能为他们提供的最佳说明是

Occasionally, my collaborators will "panic" when there is an automatic merge generated as the result a git-pull, and just accept the default commit message. Before this commit gets pushed, I want to be sure the message gets fixed, but --amend seems not to work. What is the best way to fix the message that's generated in this scenario. The best instructions I can come up with for them are

git reset --soft HEAD~
git merge -m <message> <the tracked remote branch>

但这似乎有点令人恐惧(reset)并且容易出错(必须明确输入远程跟踪分支).

but that seems a bit scary (reset) and error prone (the remote tracked branch has to be entered explicitly).

是否有一种简单的方法来更改刚刚通过与远程跟踪存储库合并而生成的提交消息? --amend为什么不起作用?

Is there a simple way to change the commit message that was just generated by merging with a remote tracking repo? Why doesn't --amend work?

推荐答案

git commit --amend在这种情况下应该可以使用.到底什么不起作用?

git commit --amend should work in this scenario. What exactly does not work?

这篇关于如何在"git-pull"自动合并后更改提交消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆