From 9ae3de7d6411e905cba0cfc5e80c7aafa42d49d4 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Sun, 27 Sep 2020 18:36:35 +0200 Subject: [PATCH] zsh: Add git alias for commiting with last message --- .config/zsh/plugins/alias.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.config/zsh/plugins/alias.zsh b/.config/zsh/plugins/alias.zsh index 6508f24..cdf30b6 100644 --- a/.config/zsh/plugins/alias.zsh +++ b/.config/zsh/plugins/alias.zsh @@ -66,6 +66,14 @@ alias gpll='git pull' alias gpull='git pull' alias gdiff='git diff' alias gd='git diff' +# git-commit, but put the last written commit message into the editor buffer +# for editing. +# Useful for example when the commit-msg hook fails but only slight +# modifications are needed. +alias git-commit-last-msg='() { + local gitdir="$(git rev-parse --git-dir)" || return + git commit -eF <(grep -v "^#" "$gitdir/COMMIT_EDITMSG") +}' ## Navigation alias ls='ls --color=auto --group-directories-first -p -v'