我最近運行了一個 git 子模塊init并update在我的暫存分支中提交。這導致 git 從我不想放入暫存并希望完全丟棄的子模塊中下載一堆更改。
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: path-to/submodule1 (modified content)
modified: path-to/submodule2 (new commits,modified content)
…
no changes added to commit (use "git add" and/or "git commit -a")
我想放棄所有這些更改,并且不向我當前的分支添加任何內容。我該怎么做呢?
uj5u.com熱心網友回復:
由于每個子模塊都是自己的 Git 存盤庫,因此您可以單獨重置每個模塊。
擺脫任何未提交的本地更改:進入每個子模塊,然后運行
git reset --hard通過
git submodule update在頂級運行,確保每個子模塊都在頂級 Git 存盤庫所需的提交中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/380607.html
上一篇:VisualStudio2017/2019/2022gitsync/pull/push/fetch操作卡住,無法停止
