Skip to content

amend

Amend this existing commit with all non-nullable values

This creates a new commit that is exactly the same as the old commit, except that any non-nullable values will be updated. The new commit has the same parents as the old commit.

Signature

ts
class Commit {
  amend(options?: AmendOptions, tree?: Tree): string;
}

Parameters

  • optionsnull | AmendOptions

    Options for amending commit.

    • authorSignaturePayload

      Signature for author.

      • emailrequired · string

        Email on the signature.

      • namerequired · string

        Name on the signature.

      • timeOptionsSignatureTimeOptions
        • offsetnumber

          Timezone offset, in minutes

        • timestamprequired · number

          Time in seconds, from epoch

    • committerSignaturePayload

      Signature for committer.

      • emailrequired · string

        Email on the signature.

      • namerequired · string

        Name on the signature.

      • timeOptionsSignatureTimeOptions
        • offsetnumber

          Timezone offset, in minutes

        • timestamprequired · number

          Time in seconds, from epoch

    • messagestring

      Full message for this commit

    • messageEncodingstring

      The encoding for the message in the commit, represented with a standard encoding name. E.g. "UTF-8". If NULL, no encoding header is written and UTF-8 is assumed.

    • updateRefstring

      If not NULL, name of the reference that will be updated to point to this commit. If the reference is not direct, it will be resolved to a direct reference. Use "HEAD" to update the HEAD of the current branch and make it point to this commit. If the reference doesn't exist yet, it will be created. If it does exist, the first parent must be the tip of this branch.

  • treenull | Tree

    Tree to use for amending commit.

Returns

  • string

    ID(SHA1) of amended commit.

Released under the MIT License.