<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國際加速解決方案。 廣告
                ## git commit 記錄緩存內容的快照 現在你使用?`git add`?命令將想要快照的內容寫入了緩存, 執行?`git commit`?就將它實際存儲快照了。 Git 為你的每一個提交都記錄你的名字與電子郵箱地址,所以第一步是告訴 Git 這些都是啥。 ~~~ $ git config --global user.name 'Your Name' $ git config --global user.email you@somedomain.com ~~~ 讓我們寫入緩存,并提交對?`hello.rb`?的所有改動。在首個例子中,我們使用?`-m`?選項以在命令行中提供提交注釋。 ~~~ $ git add hello.rb $ git status -s M hello.rb $ git commit -m 'my hola mundo changes' [master 68aa034] my hola mundo changes 1 files changed, 2 insertions(+), 1 deletions(-) ~~~ 現在我們已經記錄了快照。如果我們再執行?`git status`,會看到我們有一個“干凈的工作目錄”。 這意味著我們在最近一次提交之后,沒有做任何改動 —— 在我們的項目中沒有未快照的工作。 ~~~ $ git status # On branch master nothing to commit (working directory clean) ~~~ 如果你漏掉了?`-m`?選項,Git 會嘗試為你打開一個編輯器以填寫提交信息。 如果 Git 在你對它的配置中找不到相關信息,默認會打開?`vim`。屏幕會像這樣: ~~~ # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: hello.rb # ~ ~ ".git/COMMIT_EDITMSG" 9L, 257C ~~~ 在此,你在文件頭部添加實際的提交信息。以“#”開頭的行都會被無視 ——Git 將?`git status`?的輸出結果放在那兒以提示你都改了、緩存了啥。 通常,撰寫良好的提交信息是很重要的。以開放源代碼項目為例,多多少少以以下格式寫你的提示消息是個不成文的規定: 簡短的關于改動的總結(25個字或者更少) 如果有必要,更詳細的解釋文字。約 36 字時換行。在某些情況下, 第一行會被作為電子郵件的開頭,而剩余的則會作為郵件內容。 將小結從內容隔開的空行是至關重要的(除非你沒有內容); 如果這兩個待在一起,有些 git 工具會犯迷糊。 空行之后是更多的段落。 - 列表也可以 - 通常使用連字符(-)或者星號(*)來標記列表,前面有個空格, 在列表項之間有空行,不過這些約定也會有些變化。 ~~~ # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: hello.rb # ~ ~ ~ ".git/COMMIT_EDITMSG" 25L, 884C written ~~~ 提交注解是很重要的。因為 Git 很大一部分能耐就是它在組織本地提交和與他人分享的彈性, 它很給力地能夠讓你為邏輯獨立的改變寫三到四條提交注解,以便你的工作被同仁審閱。因為提交與推送改動是有區別的, 請務必花時間將各個邏輯獨立的改動放到另外一個提交,并附上一份良好的提交注解, 以使與你合作的人能夠方便地了解你所做的,以及你為何要這么做。 ### git commit -a?自動將在提交前將已記錄、修改的文件放入緩存區 如果你覺得?`git add`?提交緩存的流程太過繁瑣,Git 也允許你用?`-a`?選項跳過這一步。 基本上這句話的意思就是,為任何已有記錄的文件執行?`git add`?—— 也就是說,任何在你最近的提交中已經存在,并且之后被修改的文件。 這讓你能夠用更 Subversion 方式的流程,修改些文件,然后想要快照所有所做的改動的時候執行?`git commit -a`。 不過你仍然需要執行?`git add`?來添加新文件,就像 Subversion 一樣。 ~~~ $ vim hello.rb $ git status -s M hello.rb $ git commit -m 'changes to hello file' # On branch master # Changed but not updated: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: hello.rb # no changes added to commit (use "git add" and/or "git commit -a") $ git commit -am 'changes to hello file' [master 78b2670] changes to hello file 1 files changed, 2 insertions(+), 1 deletions(-) ~~~ 注意,如果你不緩存改動,直接執行?`git commit`,Git 會直接給出?`git status`?命令的輸出,提醒你啥也沒緩存。我已將該消息中的重要部分高亮,它說沒有添加需要提交的緩存。 如果你使用?`-a`,它會緩存并提交每個改動(不含新文件)。 現在你就完成了整個快照的流程 ——改些文件,然后用?`git add`?將要提交的改動提交到緩存, 用?`git status`?和?`git diff`?看看你都改了啥,最后?`git commit`?永久地保存快照。 > **簡而言之**,執行?`git commit`?記錄緩存區的快照。如果需要的話,這個快照可以用來做比較、共享以及恢復。
                  <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>

                              哎呀哎呀视频在线观看