Git aliases that are stored in origin

不羁的心 提交于 2019-12-12 07:36:24

问题


I use git with a big development team and I'd like to have a set of aliases be common across every developer. They change every so often, so I'd like to store them in origin somehow. Is there any way to set that up in git? I'm using gitosis for the git server (not sure if that would make a difference).


回答1:


1) Create .gitalias files with something like this:

[alias]
  # full status
  s = !git status -sb && git submodule foreach --recursive git status -sb

2) Commit this file.

3) Add following lines to .git/config:

[include]
    path = ../.gitalias

4) Ask all members of your team to repeat step 3.




回答2:


You can versionning in your gitosis a default ~/.gitconfig with all of you alias and share configuration.

You can't modify you .git/config by project

You can too made some script to launch some git command like :


git config alias.st status
git config alias.ci commit

Each person to launch this script had this twice alias in local git config



来源:https://stackoverflow.com/questions/2380765/git-aliases-that-are-stored-in-origin

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