![enter image description here](https://i.stack.imgur.com/CPvFi.png)
Здесь M означает Master, MS означает Master с подмодулем, а FB означает FooBranch.
FooBranch был создан из мастера в точке Mb , В точке MSd подкаталог с именем FooDir в master был заменен на подмодуль. Теперь мастер должен быть объединен с FooBranch с этим подмодулем. Мы находимся в баллах MSe и FBd master и FooBranch соответственно. FooDir существует в обеих ветках, в master это подмодуль, но это просто подкаталог в FooBranch. Отныне он также должен быть подмодулем в FooBranch, как в master.
$ git status
On branch master
”Your branch is up to date with 'origin/master'”
$ git checkout FooBranch
error: The following untracked working tree files would be overwritten by checkout:
FooDir/blablabla
Aborting
$ git checkout -f FooBranch
warning: unable to rmdir 'FooDir': Directory not empty
Checking out files: 100% (2315/2315), done.
Branch 'FooBranch' set up to track remote branch 'FooBranch' from 'origin'.
Switched to a new branch 'FooBranch'
$ git merge master
fatal: refusing to merge unrelated histories
$ git merge master --allow-unrelated-histories
Loads of CONFLICTS
$ git rebase master
...
Adding FooDir/abc.txt
error: refusing to lose untracked file at 'FooDir/abc.txt'
CONFLICT (file/directory): There is a directory with name FooDir in First snapshot of the ... Adding FooDir as FooDir~HEAD
error: Failed to merge in the changes.
Patch failed at 0001 First snapshot of the X interface.
Все изменения в FooBranch не зависят от главной ветви. Каталог FooDir в FooBranch должен быть заменен на подмодуль и должен быть копией-вставкой главной ветви.
Как мне сделать это слияние.
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: FooDir (modified content)
Я пробовал также $ git checkout master FooDir
и $ git submodule update --init
. это не помогло!
$ cat .git/config
[submodule "FooDir"]
active = true
url = git@bitbucket.org:path/FooDir.git