我在一个大型仓库上工作。最近我们决定将其中一个文件夹移动到自己的子模块中
-- aaa
-- .git
-- bbb
-- ccc
-- www # this folder is going into its own repo.
我按照说明过滤掉了 www
文件夹到这里列出的自己的回购: 将(移动)子目录分离到单独的Git存储库中。我感动了 www
文件夹出来了 aaa
回购。
我通过运行以下命令从master分支中删除了该目录:
$ cd aaa
$ git checkout master
$ git rm -rf www
$ git commit -m "remove the www/ folder from the aaa repo."
所以现在在master上,树看起来像这样:
-- aaa
-- .git
-- bbb
-- ccc
我想补充一下 www
通过运行作为子模块:
$ cd aaa
$ git checkout master
$ git submodule add git@bitbucket.org:kevinburke/www.git www
Cloning into 'www'...
remote: Counting objects: 717, done.
remote: Compressing objects: 100% (392/392), done.
remote: Total 717 (delta 318), reused 711 (delta 317)
Receiving objects: 100% (717/717), 440.52 KiB | 58 KiB/s, done.
Resolving deltas: 100% (318/318), done.
这对主人很好。但是,每当我尝试切换到另一个分支时,我都会收到以下错误:
$ cd aaa
$ git checkout other-old-branch
error: The following untracked working tree files would be overwritten by checkout:
www/1...
www/2...
www/3...
www/4...
Aborting
我怎么能删除 www
来自所有分支的文件夹 aaa
回购?大约有100个分支,因此手动执行此操作会很麻烦。
我并不担心保持存在的任何突出的变化 www
旧分支的文件夹。