<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之旅 廣告
                ## git版本回滾 > git reset --hard commit_id //commit_id為查看提交版本id號 > git log //提交日志打印 > git reflog // 返回回滾前版本 使用該命令可查看回滾之前版本的id **回滾可通過log日志打印commit結果,后悔了也可以通過 reflog獲取操作日志,找到回滾前版本id進行reset操作(此時會出現一個題,若回滾后已提交至遠程倉庫,現在回到回滾前版本則回導致remote沖突,如何解決?)** *** ##工作區與版本庫 >git 與 svn 不用的地方就是有一個暫存區的概念 1.需要提交的文件修改通通放到暫存區 git add 2.提交暫存區的所有修改至版本庫 git commit ```C git add [filename]/. //添加修改文件到暫存區 git commit -m '提交標識' // 提交當前分支到版本庫 git diff HEAD -- [filename] //查 看工作區文件與版本庫最新版本的區別 ``` 一旦提交了commit工作區狀態就變成clean 因為此時工作區與版本庫是相同的 **注意:每次修改,如果不用git add到暫存區,那么在commit提交時就不會提交到版本庫中** ----- ##撤銷修改 文件修改后 輸入git status 查看狀態 ``` PS C:\Users\clouds\Desktop\git-learnning> 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: test.md no changes added to commit (use "git add" and/or "git commit -a") ``` 此時可以看到git提示 ``` (use "git checkout -- <file>..." to discard changes in working directory) 使用git checkout -- <file>... 取消工作區對該文件的修改 兩種情況 1.文件自修改后還沒有被放到暫存區,則回退至上次提交版本庫的文件狀態 2.文件修改后已提交至暫存區,則回去至暫存區狀態. ``` ** 總結: 1.使用checkout回退會選擇最近一次add 或 commit 操作時的文件狀態 2.當你修改了工作內容并且已提交至暫存區內,此時想要丟棄修改,第一步使用 git reset HEAD filename ,再使用git checkout -- filename 進行回退 3.當提交了文件到版本庫時,想要取消則直接使用 git reset進行版本庫回退** ---- ## 文件刪除 命令: git rm filename >工作區內通過rm刪除文件,工作區和版本庫不一致時,通過git status可以查看被刪除的文件 ``` PS C:\Users\clouds\Desktop\git-learnning> rm add.txt PS C:\Users\clouds\Desktop\git-learnning> git status On branch master Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) deleted: add.txt no changes added to commit (use "git add" and/or "git commit -a") 此時,有兩種做法: 1. 通過 git rm filename 從版本庫刪除該文件 并且進行commit提交版本 2. 根據git提示 (use "git checkout -- <file>..." to discard changes in working directory) 使用該命令 撤銷刪除操作 ``` **在文件被誤刪時,大可不必擔心,通過checkout可以恢復,但需要注意的是,若checkout進行操作,會丟失,在最近一次commit的版本之后對工作區的修改** ## 總結 > 以上操作可以解決開發中文件備份以及文件丟失的問題,可以舍棄掉開發中需要不斷copy不同版本代碼的習慣啦~ 使用git優雅的進行版本迭代.
                  <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>

                              哎呀哎呀视频在线观看