Skip to main content

amend

amend | am

meld pending changes into the current commit

Replace your current commit with a new commit that contains the contents of the original commit, plus any pending changes.

By default, all pending changes (in other words, those reported by sl status) are committed. To commit only some of your changes, you can:

  • Specify an exact list of files for which you want changes committed.

  • Use the -I or -X flags to match file names to exclude or include using patterns or filesets. See sl help patterns and sl help filesets.

  • Specify the --interactive flag to open a UI where you can select individual hunks for inclusion.

By default, sl amend reuses your existing commit message and does not prompt you for changes. To change your commit message, you can:

  • Specify --edit/-e to open your configured editor to update the existing commit message.

  • Specify --message/-m to replace the entire commit message, including any commit template fields, with a string that you specify.

Specifying -m overwrites all information in the commit message, including information specified as part of a pre-loaded commit template. For example, any information associating this commit with a code review system will be lost and might result in breakages.

When you amend a commit that has descendants, those descendants are rebased on top of the amended version of the commit, unless doing so would result in merge conflicts. If this happens, run sl restack to manually trigger the rebase so that you can go through the merge conflict resolution process. Alternatively:

  • Specify --rebase to always trigger the rebase and resolve merge conflicts.

  • Specify --no-rebase to prevent the automatic rebasing of descendants.

arguments

shortnamefullnamedefaultdescription
-A--addremovemark new/missing files as added/removed before committing
-e--editprompt to edit the commit message
-i--interactiveuse interactive mode
--rebaserebases children after the amend
--toamend to a specific commit in the current stack
-T--templatedisplay with template
-I--includeinclude files matching the given patterns
-X--excludeexclude files matching the given patterns
-m--messageuse text as commit message
-l--logfileread commit message from file
-d--daterecord the specified date as commit date
-u--userrecord the specified user as committer
--no-move-detectiondisable automatic file move detection
--stackincorporate corrections into stack. see 'sl help absorb' for details