git: Make commit-last-msg available as alias
Move `git-commit-last-msg` into an autoloadable function. This way it can also be executed as external script and thus in a git alias. This makes it additionally possible to call it in vim over fugitive's `:Git`.
This commit is contained in:
12
.config/zsh/autoload/git/git-commit-last-msg
Executable file
12
.config/zsh/autoload/git/git-commit-last-msg
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Commit, but put the last written commit message into the editor buffer.
|
||||
# For this it uses .git/COMMIT_EDITMSG but deletes all lines after and including
|
||||
# the first comment of the file.
|
||||
# Useful for example when the commit-msg hook fails but only slight
|
||||
# modifications are needed.
|
||||
# Additional arguments (for example `-n` to bypass the hooks) can be passed.
|
||||
|
||||
local gitdir
|
||||
gitdir="$(git rev-parse --git-dir)" || return
|
||||
git commit -eF <(sed -n '/^#/q;p' "$gitdir/COMMIT_EDITMSG") "$@"
|
||||
Reference in New Issue
Block a user