How to customize your Git?
- 8.1 Customizing Git - Git Configuration
- For every user on the system and all their repositories configuration:
/etc/gitconfig
$ git config --system core.editor vim
- Specific user configuration:
/home/$USER/.gitconfig
$ git config --global core.editor vim
- Specific to that single repository:
/home/$USER/your-repo-directory/.git/config
$ git config core.editor vim
- For every user on the system and all their repositories configuration:
Sample configuration:
$ git config –global –list user.email=yourname@example.com user.name=Your Name
core.editor=/usr/bin/vim
alias.alias=!git config –global –list | grep ^alias alias.br=branch alias.co=checkout alias.st=status alias.ci=commit
diff.tool=bc3 diff.renames=true difftool.prompt=false difftool.bc3=trustExitCode merge.tool=bc3 mergetool.prompt=true mergetool.bc3=trustExitCode
$ vim ~/.gitconfig [user] email = yourname@example.com name = Your Name [core] editor = vim [alias] alias = !git config –global –list | grep ^alias
1
2
3
4
co = checkout
br = branch
st = status
ci = commit
[diff] tool = bc3 renames = true [difftool] prompt = false bc3 = trustExitCode [merge] tool = bc3 [mergetool] prompt = true bc3 = trustExitCode
-
csh/tcsh style alias: $ alias gst “git status” $ gst # On branch master # Initial Commit # nothing to commit (create/copy files and use “git add” to track) alias g ‘git’ alias gb ‘git branch’ alias gbr ‘git branch –remote’ alias gco ‘git checkout’
-
bash/zsh style alias: $ alias gst=”git status” $ gst # On branch master # Initial Commit # nothing to commit (create/copy files and use “git add” to track) alias g=’git’ alias gb=’git branch’ alias gbr=’git branch –remote’ alias gco=’git checkout’