Search code examples
gitclonealias

How can I automatically retain aliases when cloning a git repository?


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?


Solution

  • 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.