I have a bunch of handy aliases set up in the config file for my git repository. I will occasionally clone this repository (e.g. onto my laptop), but the clone does not included any of the aliases I've set up, presumably because the clone does not copy the git config file where the aliases are stored. I would, however, like to have these aliases available when working with the clone without having to set them up again manually. Has anyone found a good solution for this?
A:
The aliases: are they defined as being for you as the user or for a specific repository?
Each repository can have it's own specific .gitconfig (simply the config file) file within the .git directory (or wherever you set $GIT_DIR to).
For more info check out the docs: http://www.kernel.org/pub/software/scm/git/docs/git-config.html (specifically the FILES section)
Chealion
2009-04-22 17:31:05
I don't think what the manual says matches with what you're saying. Git won't (automatically) use a ".gitconfig" file in the top level of your work tree as a config file. It will read ".gitconfig" from your home directory, though, and that's typically where aliases go.
araqnid
2009-04-22 18:43:52
QUOTE:$GIT_DIR/configRepository specific configuration file. (The filename is of course relative to the repository root, not the working directory.)I only knew it existed because I used it quite heavily with one repository off github.
Chealion
2009-04-23 05:25:57
Sorry, follow up: $GIT_DIR is the .git directory in the repository - my comment did not make that obvious. Edited and fixed.
Chealion
2009-04-23 05:31:50
+5
A:
You can put aliases into your $HOME/.gitconfig file to make them apply to all repositories on a single machine. (Or set of machines sharing home directories). That's certainly where I keep all mine.
araqnid
2009-04-22 18:45:09