Skip to main content

backout

backout

reverse the effects of an earlier commit

Create an inverse commit of the specified commit. Backout is commonly used to undo the effects of a public commit.

By default, sl backout creates a new commit on top of the current commit. Specify --no-commit to skip making a new commit, leaving the changes outstanding in your working copy.

If merge conflicts are encountered during the backout, changes will be left in the working copy with conflict markers inserted. When this occurs, resolve the conflicts and then run sl commit.

By default, sl backout will abort if pending changes are present in the working copy. Specify --merge to combine changes from the backout with your pending changes.

Examples:

  • Reverse the effect of the parent of the working copy. This backout will be committed immediately:
sl backout -r .
  • Reverse the effect of previous bad commit 42e8dde:
sl backout -r 42e8ddebe
  • Reverse the effect of previous bad revision 42e8dde and leave changes uncommitted:
sl backout -r 42e8ddebe --no-commit
sl commit -m "Backout 42e8ddebe"

By default, the new commit will have one parent, maintaining a linear history. With --merge, the commit will instead have two parents: the old parent of the working copy and a new child of REV that simply undoes REV.

See sl help dates for a list of formats valid for -d/--date.

See sl help revert for a way to restore files to the state of another revision.

Returns 0 on success, 1 if nothing to backout or there are unresolved files.

arguments

shortnamefullnamedefaultdescription
--mergecombine existing pending changes with backout changes
--no-commitfalsedo not commit
-r--revrevision to back out
-e--editfalseopen editor to specify custom commit message
-t--toolspecify merge tool
-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