unknown option `allow-unrelated-histories'
10,569
I documented before how that option has been introduced in Git 2.9, June 2016 (as mentioned by merlin2011 in the comments)
Since Ubuntu LTS 14.04 comes with an old 1.9+ Git, you need to reference an up-to-date ppa:
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt install git
That ppa (Personnal Archive Package) is the git-core/+archive/ubuntu/ppa
, and will include the latest Git 2.11 release.
Comments
-
LF00 almost 2 years
I have two repos: Market and Android. When I merge Android to Market use these steps:
cd market git remote add android ../android git fetch android git merge --allow-unrelated-histories android/master
But I get this error:
ei@localhost:~/market$ git merge --allow-unrelated-histories android/master error: unknown option `allow-unrelated-histories'
My enviroment: Ubuntu LTS 14.04
ei@localhost:~/market$ git --version git version 1.9.1
Is this option removed from Git merge, or do I need some extra config?
Any help would be appreciated, thanks!
-
LF00 over 7 yearsThanks, I'm trying. Its not smoothly. I fails to update it for the Great FireWall. Now I'm setting proxy for apt-get, I used socks5. I have google some solutions to use the socks5, just on the working.
-
VonC over 7 years@KrisRoofe socks might work. If not: danrossiter.org/… or blog.zorinaq.com/my-experience-with-the-great-firewall-of-china
-
VonC about 6 years@PeterKrauss Good point. I have edited the answer to make that step more visible.
-
Emad Aghaei about 5 yearsI have the same problem, but my app is deployed on Heroku. Do you know how can I run these commands on Heroku?
-
VonC about 5 years@EmadAghayi I don't know. Maybe through the console? (devcenter.heroku.com/changelog-items/1137). I you do have a console, what version of Git is install on your Heroku dev platform?
-
SQA777 about 3 yearsI encountered the same problem as the OP (LF00). But if I am using a GIT version that is older than v2.9, shouldn't I be able to merge two local GIT repos without using the --allow-unrelated-histories option?
-
VonC about 3 years@SQA777 "older than 2.9" means a version released before 2.9, a version where
--allow-unrelated-histories
indeed did not yet exist. So yes, you should be able to merge without using that option, since a Git "older than" 2.9 does not have that option. A Git more recent than 2.9 (so 2.10 up to the current 2.31.1) would have that option. -
SQA777 about 3 yearsVonC, yes, that's what I meant - older than v2.9 means I should be allowed to merge two local GIT repos without using "--allow-unrelated histories" option. My GIT version is v1.8.3.1. However, even if I try a git merge w/o the --allow-unrelated-histories option, I get an error message: "fatal: old_repo - not something we can merge". So there's another problem that's orthogonal to the OP's question. However, I wanted to verify that I can do a merge w/o the --allow-unrelated-histories option on older versions of GIT
-
VonC about 3 years@SQA777 That is why
--allow-unrelated histories
has been introduced in 2.9: to allow such a merge. -
SQA777 about 3 years@VonC, just to be clear, are you saying that I cannot do a "git merge" on two local GIT repos unless I use the --allow-unrelated-histories option?
-
VonC about 3 years@SQA777 If those two repository does not have a common history, then yes, you cannot do a merge; only the option
--allow-unrelated-histories
would allow such a merge.