<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 9. 更改而非文件 Git 聚焦于文件的更改而非文件本身。當你說 Git 添加文件時, 你并非在告訴 Git 要添加文件到倉庫。而是說 Git 應當對文件 的當前狀態做記錄以便稍后提交。 我們將嘗試在本次實驗中探索其中的差異。 ### 初次更改:允許默認名稱 如果命令行參數未提供,更改“Hello, World”程序來接受一個 默認值。 ``` name = ARGV.first || "World" puts "Hello, #{name}!" ``` ### 添加更改 現在添加此次更改到 Git 的暫存區。 ``` $ git add hello.rb ``` ### 二次更改:添加注釋 現在給“Hello, World”程序添加一行注釋。 ``` # Default is "World" name = ARGV.first || "World" puts "Hello, #{name}!" ``` ### 檢查當前狀態 ``` $ git status ``` 你應該看到: ``` $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: hello.rb # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: hello.rb # ``` 注意 hello.rb 在狀態中被列了兩次。第一次更改已被暫存,且 準備提交。第二次更改還未暫存。如果你現在提交,那么注釋不 會保存到倉庫中。 讓我們試試看。 ### 提交 提交暫存的更改,然后重新檢查狀態。 ``` $ git commit -m "Added a default value" $ git status ``` 你應該看到: ``` $ git commit -m "Added a default value" [master 582495a] Added a default value 1 files changed, 3 insertions(+), 1 deletions(-) $ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: hello.rb # no changes added to commit (use "git add" and/or "git commit -a") ``` `status` 命令將告訴你 hello.rb 還有未記錄的更改,且不在暫存 區。 ### 添加第二次更改 現在添加第二次更改到暫存區,然后執行 `git status`。 ``` $ git add . $ git status ``` 注意:我們使用當前目錄(.)作為要添加的文件。這是一種 添加當前目錄及其子目錄下所有更改文件的習慣簡寫方式。 但因為它添加所有東東,所以在做 `add .` 前檢查狀態是一 個好主意,只是為了確定你沒有添加不想要的文件。 我想你已經明白了 `add .` 這個技巧,但為了安全在余下的 教程中我們將繼續直接添加文件。 你應該看到: ``` $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: hello.rb # ``` 現在第二次已經暫存,且準備提交。 ### 提交第二次更改 ``` $ git commit -m "Added a comment" ```
                  <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>

                              哎呀哎呀视频在线观看