Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use git subtree pull

I'm trying to pull from a remote into a folder in my repo. When using:

git subtree pull --prefix my-local/folder my-remote master

I'm getting the following error:

fatal: refusing to merge unrelated histories

I read in an other post that I can use the option --allow-unrelated-histories but when I do I get error: unknown option --allow-unrelated-histories (I put the option last)

I'm using git version 2.10.1 and Windows 10

Any help or ideas on how to move forward with this is greatly appreciated!

like image 996
Kolombiken Avatar asked Oct 28 '16 15:10

Kolombiken


People also ask

How do you pull a subtree?

Adding a subtree Specify the prefix local directory into which you want to pull the subtree. Specify the remote repository URL [of the subtree being pulled in] Specify the remote branch [of the subtree being pulled in] Specify you want to squash all the remote repository's [the subtree's] logs.

How do you push a subtree?

subtree : push: allow specifying a local rev other than HEAD ' git push '(man) lets you specify a mapping between a local thing and a remot ref. So smash those together, and have git subtree push let you specify which local thing to run split on and push the result of that split to the remote ref.


1 Answers

I had this same problem, I got it to work by adding the --squash option. This option merges the subtree changes as a single commit. I am not sure why this works but it obviously solves the history problem.

like image 183
dataskills Avatar answered Oct 06 '22 01:10

dataskills