config/git: add tree alias & reorganize
This commit is contained in:
parent
c39cd682ef
commit
4aad9349f1
|
@ -78,46 +78,46 @@
|
||||||
required = true
|
required = true
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
fzf = !fzf --preview='git diff HEAD --color=always -- {}' --tiebreak=end,index --multi
|
|
||||||
fzs = !cut -z -c2- | git fzf --read0 -d' ' --nth=2.. --bind='alt-enter:execute(nvim {2..})' --preview='test {1} != \\? && git diff --color HEAD -U5 -- {2..} | $(git config interactive.diffFilter) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %' | cut -c3-
|
|
||||||
|
|
||||||
# GET INFO
|
# GET INFO
|
||||||
|
# status
|
||||||
s = !git stl && git stb
|
s = !git stl && git stb
|
||||||
st = stb .
|
st = stb .
|
||||||
stb = status --short --branch
|
stb = status --short --branch
|
||||||
sv = --paginate status -v
|
sv = --paginate status -v
|
||||||
svv = --paginate status -vv
|
svv = --paginate status -vv
|
||||||
|
|
||||||
|
tree = !git ls-tree --full-tree --name-only -r HEAD | tree -C --fromfile . | ${PAGER:-less}
|
||||||
|
|
||||||
|
# repo
|
||||||
r = remote -v
|
r = remote -v
|
||||||
b = branch -vv
|
b = branch -vv
|
||||||
ba = b -a
|
ba = b -a
|
||||||
|
|
||||||
main = !cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | cut -d'/' -f4
|
main = !cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | cut -d'/' -f4
|
||||||
|
curbranch = symbolic-ref --short HEAD
|
||||||
sw = switch
|
upstream = !git rev-parse --abbrev-ref --symbolic-full-name @{upstream} || git rev-parse --abbrev-ref --symbolic-full-name @{push} || echo origin/$(git curbranch)
|
||||||
sc = switch -c
|
|
||||||
sd = switch -d
|
|
||||||
sm = !git switch $(git main)
|
|
||||||
|
|
||||||
find = log --patch --all --full-history
|
|
||||||
ref = reflog show --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset'
|
|
||||||
hf = log --patch --follow --find-renames=1 --
|
|
||||||
|
|
||||||
rev = rev-parse --short
|
rev = rev-parse --short
|
||||||
head = rev-parse --short HEAD
|
head = rev-parse --short HEAD
|
||||||
root = rev-parse --show-toplevel
|
root = rev-parse --show-toplevel
|
||||||
dir = rev-parse --git-dir
|
dir = rev-parse --git-dir
|
||||||
curbranch = symbolic-ref --short HEAD
|
|
||||||
upstream = !git rev-parse --abbrev-ref --symbolic-full-name @{upstream} || git rev-parse --abbrev-ref --symbolic-full-name @{push} || echo origin/$(git curbranch)
|
|
||||||
|
|
||||||
|
# history
|
||||||
lgr = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --graph
|
lgr = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --graph
|
||||||
lg = lgr HEAD @{push}
|
lg = lgr HEAD @{push}
|
||||||
lo = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges
|
lo = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges
|
||||||
lp = log -p --date=local
|
lp = log -p --date=local
|
||||||
my = lo --author [Jj]anek
|
my = lo --author [Jj]anek
|
||||||
|
|
||||||
standup = my --since yesterday --all
|
standup = my --since yesterday --all
|
||||||
co-authors = !git log | grep -i Co-Authored | awk '!a[$0]++'
|
co-authors = !git log | grep -i Co-Authored | awk '!a[$0]++'
|
||||||
when = !git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ # List all branches with their last updates
|
when = !git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ # List all branches with their last updates
|
||||||
|
|
||||||
|
find = log --patch --all --full-history
|
||||||
|
ref = reflog show --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset'
|
||||||
|
hf = log --patch --follow --find-renames=1 --
|
||||||
|
|
||||||
|
# diffs
|
||||||
d = diff
|
d = diff
|
||||||
dm = !git diff $(git merge-base $(git main) HEAD)
|
dm = !git diff $(git merge-base $(git main) HEAD)
|
||||||
dw = diff --color-words
|
dw = diff --color-words
|
||||||
|
@ -126,6 +126,14 @@
|
||||||
|
|
||||||
# MODIFY
|
# MODIFY
|
||||||
|
|
||||||
|
sw = switch
|
||||||
|
sc = switch -c
|
||||||
|
sd = switch -d
|
||||||
|
sm = !git switch $(git main)
|
||||||
|
|
||||||
|
fzf = !fzf --preview='git diff HEAD --color=always -- {}' --tiebreak=end,index --multi
|
||||||
|
fzs = !cut -z -c2- | git fzf --read0 -d' ' --nth=2.. --bind='alt-enter:execute(nvim {2..})' --preview='test {1} != \\? && git diff --color HEAD -U5 -- {2..} | $(git config interactive.diffFilter) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %' | cut -c3-
|
||||||
|
|
||||||
# Local Changes
|
# Local Changes
|
||||||
a = add -u
|
a = add -u
|
||||||
aa = add -u .
|
aa = add -u .
|
||||||
|
@ -159,7 +167,7 @@
|
||||||
format-head = !git stash && git-clang-format HEAD~ && git commit -a --amend --no-edit && git stash pop
|
format-head = !git stash && git-clang-format HEAD~ && git commit -a --amend --no-edit && git stash pop
|
||||||
|
|
||||||
sun = submodule update --no-fetch
|
sun = submodule update --no-fetch
|
||||||
# Update from remote
|
# Fetch
|
||||||
su = submodule update --init --recursive
|
su = submodule update --init --recursive
|
||||||
|
|
||||||
f = fetch
|
f = fetch
|
||||||
|
@ -168,15 +176,16 @@
|
||||||
lr = pull --rebase
|
lr = pull --rebase
|
||||||
lu = !git pull upstream ${1:-$(git curbranch)}
|
lu = !git pull upstream ${1:-$(git curbranch)}
|
||||||
|
|
||||||
rg = rmgonebranches
|
# Push
|
||||||
gcr = !git gc && git repack -a -d
|
|
||||||
|
|
||||||
# Change remote
|
|
||||||
ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease
|
ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease
|
||||||
luu = !git pull upstream ${1:-$(git curbranch)} && git push --no-verify
|
luu = !git pull upstream ${1:-$(git curbranch)} && git push --no-verify
|
||||||
pf = push --force-with-lease
|
pf = push --force-with-lease
|
||||||
cap = !git commit --amend --no-edit && git push --force-with-lease
|
cap = !git commit --amend --no-edit && git push --force-with-lease
|
||||||
|
|
||||||
|
# CLEANUP
|
||||||
|
rg = rmgonebranches
|
||||||
|
gcr = !git gc && git repack -a -d
|
||||||
|
|
||||||
[includeIf "gitdir:yadm/repo.git"]
|
[includeIf "gitdir:yadm/repo.git"]
|
||||||
path = "~/.config/yadm/gitconfig"
|
path = "~/.config/yadm/gitconfig"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue