2

I have a git repo that requires a number of atypical settings. I'd like to set it up so that when people clone my repo and work with branches they don't have to follow a list of steps. But I also don't want to get in the way of dealing with other repos they work with, possibly even in the same project.

I want

  • git config remote.<remote>.push HEAD:/refs/for/something
  • git config branch.<branch>.merge refs/head/something (where branch's remote is <remote>)

Is there some way to configure this so that just by cloning the repo everything is set up properly?

Hounshell
  • 5,321
  • 4
  • 34
  • 51

1 Answers1

3

There isn't. That's intentional. Your repo is yours. You have complete control over what goes on in it, nothing happens until you explicitly act.

To help others set up their repos correctly for your project easiest might be to provide a ~repo/config setup~ script they can run with or without looking at what it's going to do.

Another thing you could do, though it looks a bit problematic for your needs here, is to set up the default repo template at your site with the configs you're suggesting. That way people at your site will get your desired setup by default. Anybody who knows enough to have their own default will have no trouble at all running a repo setup script.

About as close as I can get to making the setup brainless is to provide a custom template, possibly by a simple frontender (e.g. complete contents git clone --template=path/to/yourproject/template "$@").

jthill
  • 55,082
  • 5
  • 77
  • 137
  • Ok. Is there a way to accomplish that second goal via a simple, straightforward, one-time script? – Hounshell Nov 06 '14 at 19:08
  • Sure. Init a repo, configure it how you like (even put some initial content in it if you want, I've got templates with a precanned makefile), clean out anything you don't want, and Bob's your uncle: the `.git` dir is your template. You can put it anywhere. – jthill Nov 06 '14 at 19:12