.gitconfig: add some new aliases (ls, lsd, bttf, ...)

This commit is contained in:
Lexi / Zoe 2021-05-13 23:44:55 +02:00
parent 3cbfc1504d
commit eec14ac25d
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
1 changed files with 24 additions and 3 deletions

View File

@ -19,8 +19,29 @@
[diff "ansible-vault"]
textconv = ansible-vault view
[alias]
graph = log --all --graph --decorate --oneline
[credential]
helper = /usr/lib/git-core/git-credential-libsecret
[pretty]
ls = tformat:%C(yellow)%h %Cgreen%ad %Creset%s %Cblue[%an]%C(auto)%d
lsd = tformat:%>|(13)%C(yellow)%h %Cgreen%ad %Creset%s %Cblue[%an]%C(auto)%d
[alias]
# Various aliases for showing pretty and compact git logs
ls = log --pretty=ls --decorate --date=iso
lsd = log --pretty=lsd --decorate --date=iso --all --graph
# Compact version of git status
stat = status -s
# Get name of remote default branch (e.g. main or master)
default-branch = !git symbolic-ref --short refs/remotes/origin/HEAD | sed 's!^origin/!!'
# Push a new branch to origin by setting the upstream branch
pushnew = "!f() { CURRENT=$(git branch --show-current); git push -u origin ${1-$CURRENT}; }; f"
# "back to the future": switch to default branch and pull
bttf = "!f() { DEFAULT=$(git default-branch); git switch ${1-$DEFAULT} && git pull --rebase --prune; }; f"
# Reset HEAD to last commit, but keep files as they are
undo = reset HEAD~1 --mixed