On Thu, Aug 04, 2016 at 04:45:56PM +0200, Mathieu Lirzin wrote:
> With gpg-agent and git properly setup, signing every local commit is not
> that inconvenient IME.

And if you don't want to sign every commit as you work (it can be
tedious if your gpg-agent has a short cache lifetime), you can use
git-rebase to sign a commit range before pushing, as in this shell
script:

git-sign () {
        case $# in
                ("0") range=HEAD  ;;
                ("1") range=$1  ;;
                (*) echo "too many arguments" >&2; return 1 ;;
        esac

        git rebase "$range" --exec "git commit --amend --no-edit --gpg-sign" || 
git rebase --abort
}

So, if I have 4 commits to push, I do `git-sign HEAD~4`.

Reply via email to