From 2fb53e6f2bfb6e79c43b578b212fb3183cc6dbf6 Mon Sep 17 00:00:00 2001 From: bretello Date: Tue, 21 Jun 2022 23:06:21 +0200 Subject: [PATCH] zsh: functions: cleanup git functions, add git-show-changes --- functions/git.zsh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/functions/git.zsh b/functions/git.zsh index 0d9e943..697c4c7 100644 --- a/functions/git.zsh +++ b/functions/git.zsh @@ -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^.. +}