Git aliases that are stored in origin
Asked Answered
P

3

13

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

Protest answered 4/3, 2010 at 16:10 Comment(1)
jga, did you manage to find a solution to this apart from a script suggestion?Autoplasty
C
11

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.

Cuddy answered 6/5, 2014 at 18:57 Comment(1)
Tip: automate part 4 by making it happen as a side-effect in a before- or after-hook of the build-tool (npm, make, sbt, scons ... whatever) your project uses.Stooge
B
1

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

Boice answered 4/3, 2010 at 17:21 Comment(0)
K
1

Maintaining global .gitconfig separately as a git repository enables sharing aliases by multiple git repositories as well as across multiple workstation and users.

Please checkout answer here - https://mcmap.net/q/907209/-how-to-share-git-aliases-across-multiple-workstations

Kearse answered 24/1, 2023 at 13:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.