我的一個專案中有一個 Git 子模塊,我正在嘗試在我進行了一些更改的本地副本上更新它。我希望遙控器覆寫我的本地更改,但是當我嘗試以下命令時,沒有任何反應,我仍然看到我的本地更改。
joesan@joesan-S-14-v5:~/Projects/Private/github-docs/joesan-me/themes/hugo-clarity$ git status
HEAD detached at d5800ff
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)
modified: exampleSite/config/_default/params.toml
no changes added to commit (use "git add" and/or "git commit -a")
joesan@joesan-S-14-v5:~/Projects/Private/github-docs/joesan-me/themes/hugo-clarity$
我在這里做錯了什么?
uj5u.com熱心網友回復:
作為@torek評論說,git status就是只顯示您的混帳回購協議的當前狀態。它不會做任何事情。
git reset --hard當你在超級回購根時,你不能簡單地使用。您應該cd在reset,checkout或之前進入子模塊restore。
所以:
cd path/to/submodule
git reset --hard # or git restore .
如果有很多子模塊或者你不想cd進入它,你可以使用:
git submodule foreach git reset --hard
但這會影響超級回購下的所有子模塊,請注意!
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/391831.html
上一篇:錯誤:設定上游時不允許上傳代碼
