dotfiles/home/.config/git/config

105 lines
4 KiB
Plaintext
Raw Normal View History

2022-10-29 18:25:42 +00:00
[user]
name = ItsDrike
email = itsdrike@protonmail.com
2023-02-17 10:26:45 +00:00
signingkey = FA2745890B7048C0
2022-10-29 18:25:42 +00:00
[alias]
quickclone = "clone --single-branch --depth=1"
bareclone = "!sh -c 'git clone --bare \"$0\" \"$1\"/.bare; echo \"gitdir: ./.bare\" > \"$1/.git\"'"
bareinit = "!sh -c 'git init --bare \"$0\"/.bare; echo \"gitdir: ./.bare\" > \"$0/.git\"'"
cleanup = "!default_branch=$(git remote show origin | awk '/HEAD branch/ {print $NF}'); git remote prune origin && git checkout -q $default_branch && git for-each-ref refs/heads/ '--format=%(refname:short)' | while read branch; do mergeBase=$(git merge-base $default_branch $branch) && [[ $(git cherry $default_branch $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == '-'* ]] && git branch -D $branch; done"
m = "merge"
2023-02-17 10:27:01 +00:00
f = "fetch"
2022-10-29 18:25:42 +00:00
p = "push"
2023-02-17 10:27:01 +00:00
pu = "!git push --set-upstream origin `git symbolic-ref --short HEAD`"
pf = "push --force"
2022-10-29 18:25:42 +00:00
pl = "pull"
s = "status --short --branch"
ss = "status"
ch = "checkout"
chb = "checkout -b"
undo = "reset --soft HEAD~"
redo = "reset HEAD@{1}"
unstage = "restore --staged"
c = "commit"
ca = "commit --ammend"
ci = "commit --interactive"
cm = "commit --message"
cv = "commit --verbose"
a = "add"
aa = "add --all"
ap = "add --patch"
au = "add --update"
d = "diff"
dc = "diff --cached"
ds = "diff --staged"
dw = "diff --word-diff"
dcm = "!sh -c 'git diff $0~ $0'"
2023-05-22 14:41:21 +00:00
linediff = "!sh -c 'git diff --unified=0 $1 $2 | grep -Po \"(?<=^\\+)(?!\\+\\+).*\" '"
2022-10-29 18:25:42 +00:00
b = "branch"
ba = "branch --all"
bd = "branch --delete"
bD = "branch --delete --force"
bm = "branch --move"
bM = "branch --move --force"
bb = "!better-git-branch"
2022-10-29 18:25:42 +00:00
r = "rebase"
ri = "rebase -i"
rc = "rebase --continue"
l = "log --oneline --decorate --all --graph"
lp = "log --patch"
lo = "log --pretty=oneline --abbrev-commit --graph"
lg = "log --all --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
2023-10-10 19:27:38 +00:00
loog = "log --format=fuller --show-signature --all --color --decorate --graph"
2022-10-29 18:25:42 +00:00
2023-02-17 10:27:01 +00:00
make-patch = "diff --no-prefix --relative"
2022-10-29 18:25:42 +00:00
set-upstream = "!git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`"
fixup-picker = "!git log -n 50 --pretty=format:'%h %s' --no-merges | fzf | cut -c -7 | xargs -o git commit --fixup";
staash = "stash --all";
2022-10-29 18:25:42 +00:00
stash-staged = "!sh -c 'git stash --keep-index; git stash push -m \"staged\" --keep-index; git stash pop stash@{1}'"
reauthor-all = "rebase --root -r --exec 'git commit --amend --no-edit --reset-author --no-verify'";
2022-10-29 18:25:42 +00:00
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"
show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
2023-01-13 00:29:28 +00:00
tracked-files = "ls-tree --full-tree --name-only -r HEAD"
2024-02-17 21:52:25 +00:00
tracked-text-files = "!git tracked-files | while IFS= read -r file; do mime_type=$(file -b --mime-type "$file"); [[ $mime_type == text/* ]] && echo "$file"; done"
total-lines = "!git tracked-text-files | xargs cat | wc -l"
2023-01-13 00:29:28 +00:00
total-files = "!git tracked-files | wc -l"
2023-02-17 10:27:01 +00:00
total-commits = "!git log --oneline | wc -l"
comitter-lines = "!git log --author=\"$1\" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf \"added lines: %s, removed lines: %s, total lines: %s\\n\", add, subs, loc }' #"
2022-10-29 18:25:42 +00:00
[credential]
helper = store --file ~/.config/git/git-credentials
[core]
excludefile = ~/.config/git/global_gitignore
2023-05-22 14:41:34 +00:00
editor = nvim
2022-10-29 18:25:42 +00:00
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
line-numbers = true
[merge]
conflictstyle = diff3
[diff]
tool = vimdiff
[fetch]
prune = true
[commit]
gpgsign = true
[init]
defaultBranch = main