unknown option `allow-unrelated-histories'
Asked Answered
G

1

8

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!

Glottochronology answered 28/12, 2016 at 6:48 Comment(4)
This answer seems to indicate that this option was introduced in 2.9 and that your version of git should default to the behavior with this option set.Pinter
Thank you. I've done apt-get update and apt-get upgrade. I thought after that my version is the latest. From you comment, I've to manuall install the latest version of git. I'll try it now.Glottochronology
Those two commands will generally only get you to the latest version of git that the repository maintainers have updated the repository to, and your version of Ubuntu was released in April 2014.Pinter
Thanks again. got it.Glottochronology
V
19

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.

Voyeurism answered 28/12, 2016 at 7:38 Comment(11)
Thanks, 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.Glottochronology
@KrisRoofe socks might work. If not: danrossiter.org/… or blog.zorinaq.com/my-experience-with-the-great-firewall-of-chinaVoyeurism
@PeterKrauss Good point. I have edited the answer to make that step more visible.Voyeurism
I have the same problem, but my app is deployed on Heroku. Do you know how can I run these commands on Heroku?Fugacity
@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?Voyeurism
I 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?Citreous
@Citreous "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.Voyeurism
VonC, 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 GITCitreous
@Citreous That is why --allow-unrelated histories has been introduced in 2.9: to allow such a merge.Voyeurism
@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?Citreous
@Citreous 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.Voyeurism

© 2022 - 2024 — McMap. All rights reserved.