2

Short

Globally in ~/.gitconfig as well as per repo in .git/config some settings (such as merge strategies) can be configured. None of these options is kept in the repo itself. Is there a way to define merge strategies that live in the repo (just as .gitigrore and .gitattributes)?

Background

Assumed I have some sort of boilerplate git repo that is meant to be forked and used as a starting point for certain projects. Also since the master boilerplate can change but should be in sync with its 'child projects' (or vice versa), I want to add the boilerplate as upstream. This way I am able to git fetch upstream && git merge upstream/master from time to time to keep up with the changes in the boilerplate.

Now: Certain files will exist in all repos and should intentionally NOT in sync. Take README.md as an obvious example.

jub0bs
  • 60,866
  • 25
  • 183
  • 186
sontags
  • 3,001
  • 3
  • 19
  • 25

1 Answers1

1

Is there a way to define merge strategies that live in the repo (just as .gitignore and .gitattributes)?

Not with native git: anything config-related is a bit too dangerous to be kept in the repo, and should be set by the user explicitly.
See "Is it possible to clone git config from remote location?".

One workaround would be to version a "setup" script which would be in charge to perform the requested git config commands.
Each user would have to execute it once after a git clone.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250