zsh: functions: cleanup git functions, add git-show-changes

pull/6/head
bretello 2022-06-21 23:06:21 +02:00
parent 5f4b4538bb
commit 2fb53e6f2b
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
1 changed files with 9 additions and 4 deletions

View File

@ -39,11 +39,11 @@ compdef "__git_completion_wrapper __git_recent_branches" git-switch-recent-branc
# Runs git log with fzf with preview
function fgitlog() {
git log --oneline $@ | fzf --multi --preview 'git -p show --color=always {+1}' --preview-window=right,60%
git showtool $(git log --oneline $@ | fzf --multi --preview 'git -p show --color=always {+1}' --preview-window=right,60% | awk '{print $1}')
}
compdef _git fgitlog=git-log
git-commit-show() {
function git-commit-show() {
git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" $@ |
fzf --ansi --no-sort --reverse --tiebreak=index --preview \
'f() {
@ -59,13 +59,18 @@ git-commit-show() {
}
compdef "__git_completion_wrapper __git_recent_commits" git-commit-show
git-fixup() {
function git-fixup() {
git commit --fixup=$1
git -c sequence.editor=true rebase --interactive --autosquash $1^
}
compdef "__git_completion_wrapper __git_recent_commits" git-fixup
git-diff-branch() {
function git-diff-branch() {
git diff $@
}
compdef "__git_completion_wrapper __git_branch_names" git-diff-branch
function git-show-changes(){
git log --reverse HEAD^..
}