git commit --amend 改写提交
生活随笔
收集整理的這篇文章主要介紹了
git commit --amend 改写提交
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. commit --amend
為了節省時間,這個教程使用現有的歷史記錄作為本地數據庫。
從這里下載
我們將修改最近一次的提交。
首先進入stepup-tutorial/tutorial1目錄。本地端的歷史記錄狀態如下圖顯示。
用log命令確認歷史記錄。
$ git log commit 326fc9f70d022afdd31b0072dbbae003783d77ed Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:17:56 2012 +0900添加add的說明commit 48eec1ddf73a7fb508ef664efd6b3d873631742f Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:16:14 2012 +0900first commit首先打開sample.txt檔案,并添加commit的注釋。
連猴子都懂的Git命令 add 把變更錄入到索引中 commit 記錄索引的狀態添加?--amend 選項,然后提交。
$ git add sample.txt $ git commit --amend編輯工具會顯示最近一次提交的提交消息,把消息修改為「添加add和commit的講解」并進行保存。
現在已經修改了提交的內容,然后用log命令確認歷史記錄和提交消息。
$ git log commit e9d75a02e62814541ee0410d9c1d1bf47ab1c057 Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:17:56 2012 +0900添加add和commit的講解commit 48eec1ddf73a7fb508ef664efd6b3d873631742f Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:16:14 2012 +0900first commit from: http://backlogtool.com/git-guide/cn/stepup/stepup7_1.html
總結
以上是生活随笔為你收集整理的git commit --amend 改写提交的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: git cherry-pick改写提交
- 下一篇: git revert改写提交