commitfossilgit-amend

amend commit in Fossil


In Git, to change the most recent commit on the current branch one uses the --amend option to git-commit.

What would be the closest operation in Fossil? Is there a way to add a GPG signature to an unsigned commit (git commit --amend -S)?


Solution

  • fossil amend can also just update the commit message:

        fossil amend COMMIT_ID -m 'my new commit message'
    

    or

        fossil amend COMMIT_ID -e # launch $EDITOR to revise message
    

    (These add a control artifact with the new/revised message which Fossil will display instead of the original.)

    It has other functions as well: https://fossil-scm.org/fossil/help?cmd=amend

    One possible way to add a sign-off to a commit might be:

        fossil amend COMMIT_D --tag sign-off=my_name
    

    You could add a PGP/GPG signature to unsigned commit by turning on the manifest setting, checking out that commit, generating the PGP/GPG signature, then

        fossil amend COMMIT_ID --tag signature=SIGNATURE
    

    Of course, this is harder than if amend directly supported adding a signature.

    Note that the tag command provides more options for adding/removing tags to an existing commit. https://fossil-scm.org/fossil/help?cmd=tag