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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] # 從git倉庫中移除文件 參考 git pro pages34 我們想把文件從 Git 倉庫中刪除(亦即從暫存區域移除),但仍然希望保留在當前工作目錄中。換句話說,你想讓文件保留在磁盤,但是并不想讓 Git 繼續跟蹤。當你忘記添加 .gitignore 文件,不小心把一個很大的日志文件或一堆 .a 這樣的編譯生成文件添加到暫存區時,這一做法尤其有用。為達到這一目的,使用 --cached 選項: ```plain $ git rm --cached README ``` # 對上次提交進行重新提交 有時候我們提交完了才發現漏掉了幾個文件沒有添加,或者提交信息寫錯了。此時,可以運行帶有 --amend 選項的提交命令嘗試重新提交: ```plain $ git commit --amend ``` # 查看已跟蹤文件 ```plain git ls-files ``` # 重命名本地分支 重命名分支 A(oldName) 為分支 B(newName) ```plain git branch -m <oldName> <newName> ``` # 重命名當前分支 ```plain git branch -m <newName> ``` # 修改遠程分支 ```plain // 直接修改 git remote set-url origin [url] // 刪除再添加 git remote rm origin git remote add origin [url] ``` # 查看遠程倉庫地址 ```plain git remote -v ``` # 修改遠程倉庫地址 ```plain git remote set-url origin [url] ``` # 儲藏變更 Git 工具 - 儲藏(Stashing) ## 儲藏 ```plain git stash ``` ### 查看儲藏列表 ```plain git stash list ``` ### 查看儲藏內容 ```plain git stash show -p stash@{0} ``` ## 恢復儲藏 ```plain git stash apply --index ``` ## 恢復儲藏并從儲藏列表刪除 ```plain git stash pop --index ``` ## 清空儲藏列表 ```plain git stash clear ``` # 打標簽 ## 查看已有標簽 ```plain git tag ``` 篩選特定標簽 ```plain git tag -l 'v1.4.4.*' ``` ## 打標簽 1、輕量級標簽 ```plain git tag v1.4 ``` 2、含附注的標簽 ```plain git tag -a v1.4 -m 'my version v1.4' ``` ## 查看標簽 ```plain git show v1.4 ``` # 推送標簽 git push 時并不會推送標簽,需要顯示命令來推送: ```plain git push origin v1.4 // 或者一次推送所有本地新增標簽 git push origin --tags ``` # 刪除某個 commit 例如提交歷史如下: ```plain commit 58211e7a5da5e74171e90d8b90b2f00881a48d3a Author: test <test@36nu.com> Date: Fri Sep 22 20:55:38 2017 +0800 add d.txt commit 0fb295fe0e0276f0c81df61c4fd853b7a000bb5c Author: test <test@36nu.com> Date: Fri Sep 22 20:32:45 2017 +0800 add c.txt commit 7753f40d892a8e0d14176a42f6e12ae0179a3210 Author: test <test@36nu.com> Date: Fri Sep 22 20:31:39 2017 +0800 init ``` 假如要刪除備注為 `add c.txt`,commit 為`0fb295fe0e0276f0c81df61c4fd853b7a000bb5c`的這次提交 1、首先找到此次提交之前的一次提交的commit`7753f40d892a8e0d14176a42f6e12ae0179a3210` 2、執行 `git rebase -i 7753f40` 3、將`0fb295f`這一行前面的 pick 改為 drop,然后按照提示保存退出 # 清理無效的遠程追蹤分支 ```plain git remote prune origin ``` # 僅合并某些提交 cherry-pick cherry-pick 和它的名稱一樣,精心挑選,挑選一個我們需要的 commit 進行操作。它可以用于將在其他分支上的 commit 修改,移植到當前的分支。、 簡單操作: ```plain git cherry-pick <commit-id> ``` 批量操作 ```plain git cherry_pick <start-commit-id>…<end-commit-id> ``` 它的范圍就是 start-commit-id 到 end-commit-id 之間所有的 commit,但是它這是一個 (左開,右閉\] 的區間,也就是說,它將不會包含 start-commit-id 的 commit。 而如果想要包含 start-commit-id 的話,就需要使用 ^ 標記一下,就會變成一個 \[左閉,右閉\] 的區間,具體命令如下: ```plain git cherry-pick <start-commit-id>^...<end-commit-id> ``` # 子模塊 ## 添加子模塊 ```plain git submodule add "子模塊倉庫地址" ``` ## 克隆含有子模塊的倉庫 ### 方式一 ```plain git clone "主項目遠程倉庫地址" ``` 此時子模塊目錄為空的,運行: ```plain git submodule init git submodule update ``` ### 方式二 ```plain git clone --recursive "主項目遠程倉庫地址" ``` ## 拉取子模塊最新修改 ### 方式一 拉取: ```plain git fetch [遠程分支名稱] ``` 合并: ```plain git merge [分支名稱] ``` ### 方式二 ```plain git submodule update --remote ``` 此命令默認會假定你想要更新并檢出子模塊倉庫的 master 分支,可以通過以下命令設置想要跟蹤的子模塊分支: ```plain git config -f .gitmodules submodule."子模塊名稱".branch "要跟蹤的分支名稱" ``` ## 在子模上工作 ### 推送時檢查所有子模塊是否已推送 ```plain git push origin dev --recurse-submodules=check ``` ## A git directory for '...' is found locally with remote(s) 問題解決 詳細問題: ```plain git submodule add https://github.com/iissnan/hexo-theme-next.git themes/next --branch master A git directory for 'themes/next' is found locally with remote(s): origin https://github.com/XXX/hexo-theme-next.git If you want to reuse this local git directory instead of cloning again from https://github.com/iissnan/hexo-theme-next.git use the '--force' option. If the local git directory is not the correct repo or you are unsure what this means choose another name with the '--name' option. ``` ### 解決方案 1、git rm –-cached themes/next 2、刪除 .gitmodules 文件中如下內容: ```plain [submodule "themes/next"] path = themes/next url = https://github.com/XXX/hexo-theme-next.git ``` 3、刪除 .git/config 文件中如下內容 ```plain [submodule "path_to_submodule"] url = https://github.com/XXX/hexo-theme-next.git ``` 4、rm -rf .git/modules/themes/next 5、重新添加子模塊 ## 參考連接 [Git-document:Git 工具 - 子模塊](https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E5%AD%90%E6%A8%A1%E5%9D%97) [GIT使用問題記錄](http://blog.bflyer.com/2017/07/23/GIT%E4%BD%BF%E7%94%A8%E9%97%AE%E9%A2%98%E8%AE%B0%E5%BD%95-%E6%8C%81%E7%BB%AD%E6%9B%B4%E6%96%B0/)
                  <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>

                              哎呀哎呀视频在线观看