diff --git a/.gitignore b/.gitignore index 4bf3f70..a06f277 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file +!home/user/.tmux/example-background-job + +home/user/.config/git/local \ No newline at end of file diff --git a/home/user/.config/git/aliases b/home/user/.config/git/aliases new file mode 100644 index 0000000..cba4e23 --- /dev/null +++ b/home/user/.config/git/aliases @@ -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" \ No newline at end of file diff --git a/home/user/.config/git/config b/home/user/.config/git/config index b0d8242..a27c083 100644 --- a/home/user/.config/git/config +++ b/home/user/.config/git/config @@ -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:" \ No newline at end of file +[include] + path = ~/.config/git/url-aliases + path = ~/.config/git/aliases + path = ~/.config/git/local \ No newline at end of file diff --git a/home/user/.config/git/url-aliases b/home/user/.config/git/url-aliases new file mode 100644 index 0000000..6c9800d --- /dev/null +++ b/home/user/.config/git/url-aliases @@ -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:" \ No newline at end of file diff --git a/install-hooks/git/post-install b/install-hooks/git/post-install deleted file mode 100755 index 7e36cf1..0000000 --- a/install-hooks/git/post-install +++ /dev/null @@ -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}" \ No newline at end of file