git revert改写提交
生活随笔
收集整理的這篇文章主要介紹了
git revert改写提交
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
教程3 改寫提交!
2. revert
為了節省時間,這個教程使用現有的歷史記錄作為本地數據庫。
從這里下載
我們將用revert命令來取消「添加pull的講解」提交。
首先進入stepup-tutorial/tutorial2目錄。本地端的歷史記錄的狀態如下圖顯示。
用log命令確認歷史記錄
$ git log commit 0d4a808c26908cd5fe4b6294a00150342d1a58be Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:19:26 2012 +0900添加pull的說明commit 9a54fd4dd22dbe22dd966581bc78e83f16cee1d7 Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:19:01 2012 +0900添加commit的說明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檔案,確認內容。
連猴子都懂的Git命令 add 把變更錄入到索引中 commit 記錄索引的狀態 pull 取得遠端數據庫的內容用revert取消「添加pull的講解」提交。
$ git revert HEAD [master d47bb1d] Revert "添加pull的說明"1 files changed, 1 insertions(+), 2 deletions(-)打開sample.txt檔案看看,如果pull的說明消失了,就表明取消提交成功了。
用log命令確認歷史記錄
$ git log commit 7bcf5e3b6fc47e875ec226ce2b13a53df73cf626 Author: yourname <yourname@yourmail.com> Date: Wed Jul 18 15:46:28 2012 +0900Revert "添加pull的說明"This reverts commit 0d4a808c26908cd5fe4b6294a00150342d1a58be.commit 0d4a808c26908cd5fe4b6294a00150342d1a58be Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:19:26 2012 +0900添加pull的說明commit 9a54fd4dd22dbe22dd966581bc78e83f16cee1d7 Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:19:01 2012 +0900添加commit的說明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 from: http://backlogtool.com/git-guide/cn/stepup/stepup7_2.html 《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的git revert改写提交的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: git commit --amend
- 下一篇: git reset改写提交