有時候提交過一次記錄只有,又修改了一次,僅僅是改動一些較少的內容,可以使用git commit --amend. 添加到上次提交過程中;
--amend amend previous commit
git commit --amend # 會通過 core.editor 指定的編輯器進行編輯
git commit --amend --no-edit # 不會進入編輯器,直接進行提交
如果你之前沒有配置 core.editor 選項的時候,會出現:
error: There was a problem with the editor 'vi'. Please supply the message using either -m or -F option.
這個時候,你通過 git config 命令,配置全局變量,指定特定的編輯器就解決報錯了;之后再進行git config --amend 命令來進行編輯;
git config --global core.editor /usr/bin/vim
保持更新,轉載請注明出處。更多關於linux和分布式系統相關的知識,請關注 cnblogs.com/xuyaowen