P4n*_*1n0 3 git git-submodules
我最近运行了一个 git 子模块init并update在我的暂存分支中提交。这导致 git 从子模块下载了一堆更改,我不想将这些更改放入暂存阶段并希望完全丢弃。
Changes not staged for commit:\n (use "git add <file>..." to update what will be committed)\n (use "git restore <file>..." to discard changes in working directory)\n (commit or discard the untracked or modified content in submodules)\n modified: path-to/submodule1 (modified content)\n modified: path-to/submodule2 (new commits,modified content)\n \xe2\x80\xa6\n\n\nno changes added to commit (use "git add" and/or "git commit -a")\nRun Code Online (Sandbox Code Playgroud)\n我想放弃所有这些更改,并且不向当前分支添加任何内容。我该怎么做呢?
\n由于每个子模块都是其自己的 Git 存储库,因此您可以单独重置每个子模块。
摆脱任何未提交的本地更改:进入每个子模块,然后运行git reset --hard
通过在顶层运行,确保每个子模块都位于顶层 Git 存储库所需的提交上git submodule update。
| 归档时间: |
|
| 查看次数: |
2799 次 |
| 最近记录: |