[git] Clean up config formatting, color diffs

Made git aliasing exit if no git executable is found (which should not
happen, but still) instead of putting all aliases into the conditional.

Added unified colors to git diffs.

Cleaned up formatting of the files.
This commit is contained in:
Marty Oehme 2020-05-28 13:29:49 +02:00
parent 7895b1c052
commit 17f8ca062d
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A
2 changed files with 96 additions and 78 deletions

View file

@ -22,6 +22,18 @@
rebase = true # always rebase on pulling, obviates merge commits rebase = true # always rebase on pulling, obviates merge commits
[diff] [diff]
colorMoved = zebra # also color stuff that has simply been moved, in a classy zebra-color colorMoved = zebra # also color stuff that has simply been moved, in a classy zebra-color
[color.diff]
meta = "9"
frag = "magenta bold"
commit = "yellow bold"
old = "red bold"
new = "green bold"
whitespace = "red reverse"
[color.diff-highlight]
oldNormal = "red bold"
oldHighlight = "red bold 52"
newNormal = "green bold"
newHighlight = "green bold 22"
[rebase] [rebase]
autostash = true autostash = true
autoSquash = true autoSquash = true

View file

@ -1,56 +1,61 @@
#!/usr/bin/env sh #!/usr/bin/env sh
if ! exist git; then
return 1
fi
# git alias # git alias
if exist git; then
alias g='git'
alias ga='git add' alias g='git'
alias gaa='git add --all'
alias gai='git add -i'
alias gb='git branch'
alias gbd='git branch -d'
alias gc='git commit -v' alias ga='git add'
alias gc!='git commit -v --amend' alias gaa='git add --all'
alias gcn!='git commit -v --no-edit --amend' alias gai='git add -i'
alias gb='git branch'
alias gbd='git branch -d'
alias gcm='git checkout master' alias gc='git commit -v'
alias gcd='git checkout develop' alias gc!='git commit -v --amend'
alias gcb='git checkout -b' alias gcn!='git commit -v --no-edit --amend'
alias gco='git checkout'
alias gd='git diff' alias gcm='git checkout master'
alias gds='git diff --staged' alias gcd='git checkout develop'
alias gcb='git checkout -b'
alias gco='git checkout'
alias gi='git ignore' alias gd='git diff'
alias gds='git diff --staged'
alias glog='git log --stat' alias gi='git ignore'
alias glg='git log --oneline --decorate --graph'
alias glga='git log --oneline --decorate --graph --remotes --all'
alias glgp='git log --stat -p'
alias gf='git fetch' alias glog='git log --stat'
alias gl='git pull' alias glg='git log --oneline --decorate --graph'
alias glga='git log --oneline --decorate --graph --remotes --all'
alias glgp='git log --stat -p'
alias gpn='git push --dry-run' alias gf='git fetch'
alias gp='git push' alias gl='git pull'
alias gpf!='git push --force'
alias gpm='git pushmerge'
alias grv='git remote -v' alias gpn='git push --dry-run'
alias gp='git push'
alias gpf!='git push --force'
alias gpm='git pushmerge'
alias grs='git restore --staged' alias grv='git remote -v'
alias grs!='git restore'
alias grbi='git rebase -i' alias grs='git restore --staged'
alias grbc='git rebase --continue' alias grs!='git restore'
alias gst='git status' alias grbi='git rebase -i'
alias grbc='git rebase --continue'
alias grbm='git rebase master'
# if git is at least version 2.13, we can use git stash push alias gst='git status'
# in shells other than zsh, simply fall back to save
case "$(ps -cp "$$" -o command="")" in # if git is at least version 2.13, we can use git stash push
*zsh*) # in shells other than zsh, simply fall back to save
case "$(ps -cp "$$" -o command="")" in
*zsh*)
autoload -Uz is-at-least autoload -Uz is-at-least
if is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')"; then if is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')"; then
alias gsta='git stash push' alias gsta='git stash push'
@ -58,8 +63,9 @@ if exist git; then
alias gsta='git stash save' alias gsta='git stash save'
fi fi
;; ;;
*) alias gsta='git stash save' ;; *) alias gsta='git stash save' ;;
esac esac
alias gstp='git stash pop' alias gstp='git stash pop'
alias gstl='git stash list' alias gstl='git stash list'
fi alias gstL='git stash list --stat'