經常出現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