diff --git a/.config/git/config b/.config/git/config index 3e7b84c..ca502ff 100644 --- a/.config/git/config +++ b/.config/git/config @@ -41,17 +41,19 @@ st = status -sb stv = --paginate status -v stvv = --paginate status -vv - ln = !git --no-pager log --pretty=tformat:'%C(auto)%h -%d %s %Cgreen(%cr) %Cblue<%an>%Creset' -5 + l = !git --no-pager log --pretty=tformat:'%C(auto)%h -%d %s %Cgreen(%cr) %Cblue<%an>%Creset' -5 unstage = reset HEAD -- ready = rebase -i @{u} curbranch = symbolic-ref --short HEAD root = rev-parse --show-toplevel - dir = !git root | sed 's/$/\\/.git/g' + dir = !git root | sed 's/$/\\/.git/' | grep --color=never "/" # grep ensures a proper exit status on fail [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true +[pull] + ff = only diff --git a/.config/shell/git b/.config/shell/git index 7b3ff97..86384c5 100644 --- a/.config/shell/git +++ b/.config/shell/git @@ -2,6 +2,18 @@ alias bfg='java -jar ~/daten/dropbox/tools/bfg-1.13.0.jar' alias magit='nvim -c MagitOnly' +# if in home or xdg-config and not within a git directory, replace git by yadm +git() { + case "$PWD" in + ~|$(xdg-user-dir CONFIG)*) + if ! command git rev-parse --show-toplevel 2&>/dev/null; then + yadm "$@" + return + fi;; + esac + command git "$@"; +} + # Repo info alias gr='git remote -v' alias gb='git branch -vv' @@ -27,7 +39,8 @@ glno() { # Shortcuts alias gfs='git fetch && git status -s -b' alias glu='git pull upstream $(git curbranch)' -alias gcap!='git commit -a --amend --no-edit && git push -f' +alias gluu='git pull upstream $(git curbranch) && git push --no-verify' +alias gcap!='git commit -a --amend --no-edit && git push --force-with-lease' alias grh!='git reset --hard' alias grhr='git reset --hard $(git rev-parse --abbrev-ref --symbolic-full-name @{u})' alias gitgc='git gc && git repack -a -d' @@ -108,6 +121,7 @@ project() { gitremote() { case "$1" in http*) echo "git@$(echo "$1" | cut -d'/' -f3):$(echo "$1" | cut -d'/' -f4)/$(echo "$1" | cut -d'/' -f5)" ;; + git:*) echo "$1" ;; *) test "$3" = "cau" && 3="CAU-Kiel-Tech-Inf" test "$3" = "btl" && 3="betweenthelinesev" echo "git@git${1:-hub}.com:${3:-xerus2000}/${2:-$(basename $PWD)}.git" ;;