Git pull之后弹出填写commit信息原因

经常出现git pull之后,弹出vim,让填写一条commit信息,让人摸不着头脑。

1. 原因

git pull是先git fetch,然后再git merge,git merge的默认行为会自动commit合并结果,并且merge大部分时候不是一个 fast-forward merge,所以会弹出填写commit信息的提示。

2. 解决方法

2.1 不填写任何commit信息,直接保存提交退出vim (推荐)

2.2 使用 git pull --rebase 或  git rebase (推荐)

2.3 使用 --no-edit 选项,会自动生成一条commit message, 无需手动填写 (不推荐)

参考:

https://stackoverflow.com/questions/36418708/why-git-asks-to-enter-a-commit-message-to-explain-why-this-merge-is-necessary

https://stackoverflow.com/questions/30103847/how-can-i-stop-git-merge-prompt-message-keep-popping-up-everytime-i-do-git-pull

https://stackoverflow.com/questions/34526346/git-pull-asks-me-to-write-merge-message

原文地址:https://www.cnblogs.com/mengff/p/15514821.html