【git使用】之修改歷史commit信息
1、修改最后一次commit的信息
直接使用amend進(jìn)行修改
1.1修改commit注釋信息
git commit --amend
1.2 修改作者、郵箱
git commit --amend --author="username <email>"
例如:git commit --amend --author=“silinchen <silinccc@gmail.com
修改完成后可用git log查看是或否修改成功
2、修改某幾次commit信息
2.1 使用git log查看提交記錄
查看需要修改的內(nèi)容是哪些
2.2 rebase需要修改的commit
git rebase -i HEAD~2 # 修改最近2條修改記錄
執(zhí)行 rebase 命令后,會出現(xiàn) reabse 的編輯窗口,窗口底下會有提示怎么操作
主要就是進(jìn)入文本編輯模式,把需要修改的 commit 最前面的 pick 改為 edit或者e,修改后:wq保存退出
然后同樣使用amend修改
2.3 修改commit信息
只修改注釋
git commit --amend
只修改作者、郵箱
git commit --amend --author="username <email>" --no-edit
同時修改注釋信息、作者、郵箱
git commit --amend --author="username <email>"
修改完成后,執(zhí)行下面命令
git rebase --continue
如果是修改多條的話,重復(fù)以上操作即可
出現(xiàn)以下提示,說明全部修改已經(jīng)完成
Successfully rebased and updated refs/heads/master文章來源:http://www.zghlxwxcb.cn/news/detail-786313.html
修改完就可以正常push到遠(yuǎn)程倉庫啦~文章來源地址http://www.zghlxwxcb.cn/news/detail-786313.html
到了這里,關(guān)于【git使用】之修改歷史commit信息的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!