tags:

views:

186

answers:

2

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
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
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
Sorry, follow up: $GIT_DIR is the .git directory in the repository - my comment did not make that obvious. Edited and fixed.
Chealion
+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