0

I discovered that my favourite GUI git client (Tower) does not have an option to add the --allow-unrelated-histories parameter to git merge.

Is there a way to enable this by default on my git configuration? How?

Ps. Luckily the client is using external git, which means that if there is a global configuration option for this it should be used.

sorin
  • 161,544
  • 178
  • 535
  • 806
  • 1
    Looking through the list of config options in the docs (https://git-scm.com/docs/git-config), there doesn't seem to be anything. – Whymarrh Oct 03 '16 at 14:09

4 Answers4

1

I would not recommend changing this default. This could cause big problems for you down the road. If you need to do this as a one off you should pop into a terminal and use this answer: Git refusing to merge unrelated histories

Community
  • 1
  • 1
JustinDoesWork
  • 508
  • 1
  • 5
  • 15
  • 1
    I think this might be a comment more than an answer – Whymarrh Oct 03 '16 at 14:08
  • I am in a middle of a big repository merge work so I need to use this MANY times. Yep, in the long run I plan to remove the default config change but for the moment I would really like to have it changes so I can finish my work. – sorin Oct 03 '16 at 14:09
1

With the standard merge script, this is not (and will not be) possible. Per the documentation (emphasis mine):

--allow-unrelated-histories

By default, git merge command refuses to merge histories that do not share a common ancestor. This option can be used to override this safety when merging histories of two projects that started their lives independently. As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added.

Community
  • 1
  • 1
vossad01
  • 11,552
  • 8
  • 56
  • 109
0

There is not a way to override this default in your config. Maybe you can do this work from the command-line, or even script it?

Chris
  • 451
  • 2
  • 5
0

Try to create an alias

merge = merge --allow-unrelated-histories
Damian Rzeszot
  • 548
  • 3
  • 12