git commit
gpg.commitsign = true
&&失敗(何らかの理由で)と同じ理由で失敗する可能性がありますgpg
。コマンドを再試行すると、空のエディタが開き、メッセージが失われます。
この場合、同じメッセージでコミットを再試行するために作成したコミットメッセージを復元する方法はありますか?
ベストアンサー1
からman git-commit
:
FILES
$GIT_DIR/COMMIT_EDITMSG
This file contains the commit message of a commit in progress. If git commit exits due to an error before creating a commit, any commit message that has been provided
by the user (e.g., in an editor session) will be available in this file, but will be overwritten by the next invocation of git commit.
git commit
したがって、繰り返しではなく、次のコマンドを使用して前のメッセージを再試行できます。
$ git commit -m "$(cat .git/COMMIT_EDITMSG)"
または一般的な場合(たとえば、エイリアシングに適しています):
$ git commit -m "$(cat "$(git rev-parse --git-dir)/COMMIT_EDITMSG)")"