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

让人想犯罪 __ 提交于 2019-12-12 16:16:26

问题


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?


回答1:


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.




回答2:


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://git-scm.com/docs/git-config (specifically the FILES section)



来源:https://stackoverflow.com/questions/778262/how-can-i-automatically-retain-aliases-when-cloning-a-git-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!