Gin*_*sus 9 git git-submodules git-worktree
让\xe2\x80\x99s 说我有一个包含子模块的Git 存储库:
\n$ mkdir main-worktree\n$ cd main-worktree\n$ git init\nInitialized empty Git repository in /\xe2\x80\xa6/main-worktree/.git/\n$ git submodule add https://github.com/octocat/Hello-World.git Hello-World\nCloning into \'/\xe2\x80\xa6/main-worktree/Hello-World\'...\nremote: Enumerating objects: 13, done.\nremote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13\nReceiving objects: 100% (13/13), done.\n$ git commit -m \'Create submodule\'\n[main (root-commit) 66070b6] Create submodule\n 2 files changed, 4 insertions(+)\n create mode 100644 .gitmodules\n create mode 160000 Hello-World\nRun Code Online (Sandbox Code Playgroud)\n\n$ git worktree add ../secondary-worktree\nPreparing worktree (new branch \'secondary-worktree\')\nHEAD is now at 66070b6 Create submodule\n$ cd ../secondary-worktree\n$ git submodule update\nCloning into \'/\xe2\x80\xa6/secondary-worktree/Hello-World\'...\nSubmodule path \'Hello-World\': checked out \'7fd1a60b01f91b314f59955a4e4d4e80d8edf11d\'\nRun Code Online (Sandbox Code Playgroud)\n如何删除我secondary-worktree刚刚创建的?我尝试使用git worktree remove,但它给了我一个错误:
$ cd <path-to-main-worktree>\n$ git worktree remove ../secondary-worktree\nfatal: working trees containing submodules cannot be moved or removed\nRun Code Online (Sandbox Code Playgroud)\n
Gin*_*sus 12
git worktree remove --force <path-to-worktree-with-submodules>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2022 次 |
| 最近记录: |