我想自动化特定Qt版本的构建过程。根据{{3}},这些命令是
git clone https://code.qt.io/qt/qt5.git
git checkout v5.9.0
git submodule update --init --recursive
这很有效,结果是一个干净的工作目录,版本5.9.0签出。现在我用命令
检查了5.8.0版本git checkout v5.8.0
git submodule update --init --recursive
在更新期间,有一些警告说某些目录无法删除,因为它们不是空的。现在git status
的结果看起来像这样
HEAD detached at v5.8.0
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)
(commit or discard the untracked or modified content in submodules)
modified: qtdeclarative (untracked content)
Untracked files:
(use "git add <file>..." to include in what will be committed)
qtremoteobjects/
在Qt wiki中,清洁过程被声明为
git submodule foreach --recursive "git clean -dfx" && git clean -dfx
执行此命令时,会显示某些目录被跳过的消息 - 但未说明原因。因此,工作目录仍包含未跟踪的内容。
任何人都知道哪些神奇的命令可以真正获得干净的工作目录?
答案 0 :(得分:1)
如果您仔细阅读git clean
的联机帮助页,您会看到它的声明:
Git将拒绝删除带.git子目录或文件的目录,除非给出第二个-f。
因此,要真正获得一个干净的目录树,你必须像这样进行清理
git submodule foreach --recursive "git clean -dffx" && git clean -dffx
这将完全删除存储库。因此,如果您切换到包含子模块的另一个版本 - 必须再次克隆它。