<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 16. 撤銷提交的更改 ## 目的 > 學習如何還原已經提交到本地倉庫的更改。 ### 撤銷提交 有時候你意識到已經提交的更改不正確并想撤銷該提交。有 幾種方式可以處理這種問題,我們在本實驗中所用的方式總 是安全的。 實際上我們將通過創建新的提交來撤銷原來不想要更改的提 交。 ### 更改文件并提交 更改 hello.rb 文件成下列內容: ``` # This is an unwanted but committed change name = ARGV.first || "World" puts "Hello, #{name}!" ``` ``` $ git add hello.rb $ git commit -m "Oops, we didn't want this commit" ``` ### 創建還原提交 要撤銷已提交的更改,我們需要創建一個提交來移除由不想 要的提交所引入的更改。 ``` $ git revert HEAD ``` 這將帶你到編輯器中。你可以編輯默認的提交信息,或直接 離開它。保存并關閉文件。你應該看到: ``` $ git revert HEAD --no-edit [master a10293f] Revert "Oops, we didn't want this commit" 1 files changed, 1 insertions(+), 1 deletions(-) ``` 因為我們將撤銷我們做的最后提交,所以我們可以使用 `HEAD` 作為還原的參數。通過簡單的指定哈希值,我們可以撤銷早期 歷史中的任意提交。 注意:命令中的 `--no-edit` 可被忽略。在不打開編輯器生成輸 出時需要它。 ### 檢查日志 檢查日志來顯示我們倉庫中不想要及還原的提交。 ``` $ git hist ``` ``` $ git hist * a10293f 2013-04-13 | Revert "Oops, we didn't want this commit" (HEAD, master) [Jim Weirich] * 838742c 2013-04-13 | Oops, we didn't want this commit [Jim Weirich] * 1f7ec5e 2013-04-13 | Added a comment (v1) [Jim Weirich] * 582495a 2013-04-13 | Added a default value (v1-beta) [Jim Weirich] * 323e28d 2013-04-13 | Using ARGV [Jim Weirich] * 9416416 2013-04-13 | First Commit [Jim Weirich] ``` 這種技術將處理任何提交(雖然你可能必須解決沖突)。在 公開分享的遠程倉庫上使用分支更加安全。 ### 下一步 接下來,讓我們看看從倉庫歷史中移除最近提交所用的技術。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看