ref git config

This commit is contained in:
thek4n 2024-11-24 22:04:40 +03:00
parent a1343f2db6
commit 0e698d4f3b
5 changed files with 82 additions and 88 deletions

4
.gitignore vendored
View File

@ -30,4 +30,6 @@ home/user/.tmux/*
!home/user/.tmux/dotfiles
!home/user/.tmux/sandbox
!home/user/.tmux/ssh
!home/user/.tmux/example-background-job
!home/user/.tmux/example-background-job
home/user/.config/git/local

View File

@ -0,0 +1,47 @@
# vim: ft=gitconfig
[alias]
a = "!git ls-files --exclude-standard -m --others -t | fzf -1 -0 -m --bind load:last --preview 'git diff --color=always {2}' | cut -d' ' -f2 | xargs -r git add"
u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged"
d = diff
di = diff
ds = diff --staged
dno = diff --name-only
dw = diff --word-diff=color
co = checkout
ci = commit
cia = commit --all
amend = commit --amend --no-edit
amenda = commit --all --amend --no-edit
fuck = commit --amend
uncommit = reset --soft HEAD~1
untrack = rm --cache --
cim = "!_m() { git commit -m \"$*\"; }; _m"
cima = "!_m() { git commit -am \"$*\"; }; _m"
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"
pr = "pull --rebase"
st = status
br = branch
bm = branch --merged
bn = branch --no-merged
hist = log --pretty=format:'%Cgreen%h %Creset%cd %Cblue[%cn](%G?) %Creset%s%C(yellow)%d%C(reset)' --graph --date=relative --decorate --color=always
history = hist --all
hs = hist -n 10
hsa = hist -n 10 --all
last = log -1 HEAD
lastd = diff HEAD^ HEAD
today = hist --since=midnight
df = "!_m() { git log --pretty=format:'%h %cd [%cn] %s%d' --date=relative | fzf --bind \"enter:execute(git diff --color=always $@ {1}^ {1} | ${PAGER})\" --preview-window=65% --preview=\"git diff --color=always $@ {1}^ {1}\"; }; _m"
type = cat-file -t
dump = cat-file -p
unstage = "reset HEAD --"
count = "rev-list --count --all"
# edit conflicted file on merge
edit-unmerged = "!$EDITOR $(git ls-files --unmerged | cut -f2 | sort -u)"
# add conflicted file on merge
add-unmerged = "!git add $(git ls-files --unmerged | cut -f2 | sort -u)"
remove-remote-tag = "!f() { git tag -d $1 && git push origin :refs/tags/$1 }; f"

View File

@ -50,82 +50,7 @@
colormoved = default
colormovedws = allow-indentation-change
[alias]
a = "!git ls-files --exclude-standard -m --others -t | fzf -1 -0 -m --bind load:last --preview 'git diff --color=always {2}' | cut -d' ' -f2 | xargs -r git add"
u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged"
d = diff
di = diff
ds = diff --staged
dno = diff --name-only
dw = diff --word-diff=color
co = checkout
ci = commit
cia = commit --all
amend = commit --amend --no-edit
amenda = commit --all --amend --no-edit
fuck = commit --amend
uncommit = reset --soft HEAD~1
untrack = rm --cache --
cim = "!_m() { git commit -m \"$*\"; }; _m"
cima = "!_m() { git commit -am \"$*\"; }; _m"
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"
pr = "pull --rebase"
st = status
br = branch
bm = branch --merged
bn = branch --no-merged
hist = log --pretty=format:'%Cgreen%h %Creset%cd %Cblue[%cn](%G?) %Creset%s%C(yellow)%d%C(reset)' --graph --date=relative --decorate --color=always
history = hist --all
hs = hist -n 10
hsa = hist -n 10 --all
last = log -1 HEAD
lastd = diff HEAD^ HEAD
today = hist --since=midnight
df = "!_m() { git log --pretty=format:'%h %cd [%cn] %s%d' --date=relative | fzf --bind \"enter:execute(git diff --color=always $@ {1}^ {1} | ${PAGER})\" --preview-window=65% --preview=\"git diff --color=always $@ {1}^ {1}\"; }; _m"
type = cat-file -t
dump = cat-file -p
unstage = "reset HEAD --"
count = "rev-list --count --all"
# edit conflicted file on merge
edit-unmerged = "!$EDITOR $(git ls-files --unmerged | cut -f2 | sort -u)"
# add conflicted file on merge
add-unmerged = "!git add $(git ls-files --unmerged | cut -f2 | sort -u)"
remove-remote-tag = "!f() { git tag -d $1 && git push origin :refs/tags/$1 }; f"
[github]
user = "thek4n"
email = "thek4n@yandex.ru"
[user]
name = "thek4n"
email = "thek4n@yandex.ru"
signingkey = "thek4n"
[url "https://github.com/"]
insteadOf = "gh:"
[url "https://gist.github.com/"]
insteadOf = "gist:"
[url "https://gitlab.com/"]
insteadOf = "gl:"
[url "https://bitbucket.org/"]
insteadOf = "bb:"
[url "https://github.com/"]
insteadOf = "git@github.com:"
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
pushInsteadOf = "http://github.com/"
pushInsteadOf = "git@github.com:"
pushInsteadOf = "gh:"
[url "git@gist.github.com:"]
pushInsteadOf = "https://gist.github.com/"
pushInsteadOf = "http://gist.github.com/"
pushInsteadOf = "gist:"
[include]
path = ~/.config/git/url-aliases
path = ~/.config/git/aliases
path = ~/.config/git/local

View File

@ -0,0 +1,28 @@
# vim: ft=gitconfig
# alias gh:=https://github.com/
[url "https://github.com/"]
insteadOf = "gh:"
# alias gist:=https://gist.github.com/
[url "https://gist.github.com/"]
insteadOf = "gist:"
# alias gl:=https://gitlab.com/
[url "https://gitlab.com/"]
insteadOf = "gl:"
# alias bb:=https://bitbucket.org/
[url "https://bitbucket.org/"]
insteadOf = "bb:"
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
pushInsteadOf = "http://github.com/"
pushInsteadOf = "git@github.com:"
pushInsteadOf = "gh:"
[url "git@gist.github.com:"]
pushInsteadOf = "https://gist.github.com/"
pushInsteadOf = "http://gist.github.com/"
pushInsteadOf = "gist:"

View File

@ -1,8 +0,0 @@
#!/bin/sh
git config --global user.name "$USER"
git config --global user.email "${USER}@${HOST}"
git config --global user.signingkey "$USER"
git config --global github.user "$USER"
git config --global github.email "${USER}@${HOST}"