I
I
Ivan Volkov2018-02-16 10:52:10
git
Ivan Volkov, 2018-02-16 10:52:10

How to merge changes from git subtree?

Good afternoon. There are two separately started repositories - GUILibs and WorkProject. I decided to add the GUILibs repository as a subtree to the WorkProject. I did everything according to the subtree merging instructions . However, at the stage of the merge, an error occurs

fatal: refusing to merge unrelated histories

I found this article About Git subtree merges . It says that after git 2.9 you should use the flag
--allow-unrelated-histories

Why is there a need to use this flag? Should I always merge with this flag now if I have shared repositories? How to add a subtree correctly? How to make subtree have a common ancestor? It's impossible in my opinion.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Shumkin, 2018-02-22
@ashumkin

in general, to merge a subtree, there is a git subtree command : https://github.com/git/git/tree/master/contrib/subtree
in my opinion, it does everything you need under the hood

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question