Git: improve config & add yadm fallback
This commit is contained in:
parent
a98234a870
commit
d1aeb2535b
|
@ -41,17 +41,19 @@
|
||||||
st = status -sb
|
st = status -sb
|
||||||
stv = --paginate status -v
|
stv = --paginate status -v
|
||||||
stvv = --paginate status -vv
|
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 --
|
unstage = reset HEAD --
|
||||||
ready = rebase -i @{u}
|
ready = rebase -i @{u}
|
||||||
|
|
||||||
curbranch = symbolic-ref --short HEAD
|
curbranch = symbolic-ref --short HEAD
|
||||||
root = rev-parse --show-toplevel
|
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"]
|
[filter "lfs"]
|
||||||
clean = git-lfs clean -- %f
|
clean = git-lfs clean -- %f
|
||||||
smudge = git-lfs smudge -- %f
|
smudge = git-lfs smudge -- %f
|
||||||
process = git-lfs filter-process
|
process = git-lfs filter-process
|
||||||
required = true
|
required = true
|
||||||
|
[pull]
|
||||||
|
ff = only
|
||||||
|
|
|
@ -2,6 +2,18 @@
|
||||||
alias bfg='java -jar ~/daten/dropbox/tools/bfg-1.13.0.jar'
|
alias bfg='java -jar ~/daten/dropbox/tools/bfg-1.13.0.jar'
|
||||||
alias magit='nvim -c MagitOnly'
|
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
|
# Repo info
|
||||||
alias gr='git remote -v'
|
alias gr='git remote -v'
|
||||||
alias gb='git branch -vv'
|
alias gb='git branch -vv'
|
||||||
|
@ -27,7 +39,8 @@ glno() {
|
||||||
# Shortcuts
|
# Shortcuts
|
||||||
alias gfs='git fetch && git status -s -b'
|
alias gfs='git fetch && git status -s -b'
|
||||||
alias glu='git pull upstream $(git curbranch)'
|
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 grh!='git reset --hard'
|
||||||
alias grhr='git reset --hard $(git rev-parse --abbrev-ref --symbolic-full-name @{u})'
|
alias grhr='git reset --hard $(git rev-parse --abbrev-ref --symbolic-full-name @{u})'
|
||||||
alias gitgc='git gc && git repack -a -d'
|
alias gitgc='git gc && git repack -a -d'
|
||||||
|
@ -108,6 +121,7 @@ project() {
|
||||||
gitremote() {
|
gitremote() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
http*) echo "git@$(echo "$1" | cut -d'/' -f3):$(echo "$1" | cut -d'/' -f4)/$(echo "$1" | cut -d'/' -f5)" ;;
|
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" = "cau" && 3="CAU-Kiel-Tech-Inf"
|
||||||
test "$3" = "btl" && 3="betweenthelinesev"
|
test "$3" = "btl" && 3="betweenthelinesev"
|
||||||
echo "git@git${1:-hub}.com:${3:-xerus2000}/${2:-$(basename $PWD)}.git" ;;
|
echo "git@git${1:-hub}.com:${3:-xerus2000}/${2:-$(basename $PWD)}.git" ;;
|
||||||
|
|
Loading…
Reference in New Issue