[RndTbl] git subtree pull error

Trevor Cordes trevor at tecnopolis.ca
Thu Aug 17 05:33:12 CDT 2017

Hi to all gitters who helped me a couple of years back.  I'm implementing 
a subtree using git subtree (better fits my model than submodules), but 
I'm trying to do my 1st merge/pull (after the initial subtree import) and 
I'm getting a weird error:

git subtree pull -P Nub nub master
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

I'm conceptually confused as to why it's saying this.  The whole subtree 
command is basically the same as when I setup the remote and did the 
initial bits.  So why aren't the subtree histories related?  Or is it 
confusing the entire project with the subtree?  The google hits I get 
aren't really helping me since they aren't really specific to subtree.

If I add a squash:
git subtree pull --squash -P Nub nub master

Then it works and I can commit.

If I take out squash and add --allow-unrelated-histories it barfs because 
subtree doesn't understand --allow-unrelated-histories, though I guess I 
could do the separate parts manually and merge with 

However, in my understanding, I don't want squash nor feel I should 
require allow-unrelated-histories?  Am I wrong?  The reason I don't want 
squash is that I want all the subtree history mixed into my main project 
because I want to be able to bisect on the entire project+subtree if I 
ever need to (they are extremely tightly coupled).

Plus, I don't understand why squash solves the "unrelated histories" 
error!  That makes me nervous as to what is going on under the hood, and 
I'd like to ensure I am doing this correctly before I commit my entire 
project to a specific course of action.

Anyone understand this git subtree stuff better than me who can take a mo 
to explain?  Thanks!!!

More information about the Roundtable mailing list