I am trying to add a subtree repo for another one. and use foo
as the subtree repo and will be the directory.
After
git remote add st git@...git // st as subtree remote name
git subtree add --prefix=foo st develop
merge the subtree repo changes and use
git subtree pull --prefix=foo st develelop
since the two branch has different commit history, I met an error like:
fatal: refusing to merge unrelated histories
I found can add --squash
to merge it, but when the st repo is under developing and I want to pull the changes, that seems need to add --squash
each time and I don't want to do that.
I tried --allow-unrelated-histories
, but git subtree seems can't know the option and show error, error: unknown option allow-unrelated-histories
.
So, what is the right way to use git subtree
? or any useful links that can help me know more about this will be great thanked
System: macOS
git version: 2.14.3