Skip to main content

revert

revert

change the specified files to match a commit

With no revision specified, restore the contents of files to an unmodified state and unschedule adds, removes, copies, and renames. In other words, revert the specified files or directories to the contents they had in the current commit. If you are in the middle of an unfinished merge state, you must explicitly specify a revision.

Use the -r/--rev option to revert the given files or directories to their states as of a specific commit. Because revert does not actually check out the specified commit, the files appear as modified and show up as pending changes in sl status.

Revert causes files to match their contents in another commit. If instead you want to undo a specific landed commit, use sl backout instead. Run sl help backout for more information.

Modified files are saved with an .orig suffix before reverting. To disable these backups, use --no-backup. You can configure Sapling to store these backup files in a custom directory relative to the root of the repository by setting the ui.origbackuppath configuration option.

Returns 0 on success.

arguments

shortnamefullnamedefaultdescription
-a--allrevert all changes when no arguments given
-d--datetipmost revision matching date
-r--revrevert to the specified revision
-C--no-backupdo not save backup copies of files
-i--interactiveinteractively select the changes
-I--includeinclude files matching the given patterns
-X--excludeexclude files matching the given patterns
-n--dry-rundo not perform actions, just print output