git revert改寫提交_git

來源:互聯網
上載者:User

教程3 改寫提交。 2. revert

為了節省時間,這個教程使用現有的記錄作為本機資料庫。

從這裡下載

我們將用revert命令來取消「添加pull的講解」提交。

首先進入stepup-tutorial/tutorial2目錄。本地端的記錄的狀態如下圖顯示。

用log命令確認記錄

$ git logcommit 0d4a808c26908cd5fe4b6294a00150342d1a58beAuthor: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:19:26 2012 +0900    添加pull的說明commit 9a54fd4dd22dbe22dd966581bc78e83f16cee1d7Author: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:19:01 2012 +0900    添加commit的說明commit 326fc9f70d022afdd31b0072dbbae003783d77edAuthor: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:17:56 2012 +0900    添加add的說明commit 48eec1ddf73a7fb508ef664efd6b3d873631742fAuthor: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:16:14 2012 +0900    first 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 logcommit 7bcf5e3b6fc47e875ec226ce2b13a53df73cf626Author: yourname <yourname@yourmail.com>Date:   Wed Jul 18 15:46:28 2012 +0900    Revert "添加pull的說明"    This reverts commit 0d4a808c26908cd5fe4b6294a00150342d1a58be.commit 0d4a808c26908cd5fe4b6294a00150342d1a58beAuthor: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:19:26 2012 +0900    添加pull的說明commit 9a54fd4dd22dbe22dd966581bc78e83f16cee1d7Author: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:19:01 2012 +0900    添加commit的說明commit 326fc9f70d022afdd31b0072dbbae003783d77edAuthor: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:17:56 2012 +0900    添加add的說明commit 48eec1ddf73a7fb508ef664efd6b3d873631742fAuthor: yourname <yourname@yourmail.com>Date:   Mon Jul 16 23:16:14 2012 +0900    first commit
from: http://backlogtool.com/git-guide/cn/stepup/stepup7_2.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.