GitButler ⧓

GuidesCLI Tutorial

Operations Log

Understanding and using GitButler's operations log to track and undo changes.

GitButler maintains a detailed log of all operations, making it easy to track what happened and undo changes when needed.

Viewing the Operations Log

See all recent GitButler operations:

$ but oplog
Operations History
──────────────────────────────────────────────────
73cb1bcef2e4 2020-10-09 09:06:03 [OTHER] UpdateDependentBranchName
e0fedf918d39 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
8f5a700a5827 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
576315e97d91 2020-10-09 09:06:03 [OTHER] FileChanges
ecc36f626ccd 2020-10-09 09:06:03 [OTHER] FileChanges
8972b7c83aee 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
2587ee462fc2 2020-10-09 09:06:03 [MOVE] MoveCommit
3c3b10d46fd2 2020-10-09 09:06:03 [MOVE] MoveCommit
60abc1ab00ac 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
1b998a967b6e 2020-10-09 09:06:03 [UNDO] UndoCommit
7de38031e3ea 2020-10-09 09:06:03 [UNDO] UndoCommit
90940d115ce7 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
feaf090d0cd4 2020-10-09 09:06:03 [SQUASH] SquashCommit
ba2cccda1d1c 2020-10-09 09:06:03 [SQUASH] SquashCommit
ff6cbdbfd516 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
4530a410723b 2020-10-09 09:06:03 [AMEND] AmendCommit
746090fa5291 2020-10-09 09:06:03 [AMEND] AmendCommit
32befe7ed97c 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
3f120886370a 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
28747af0444e 2020-10-09 09:06:03 [MOVE_HUNK] MoveHunk

Undoing the last operation

Undo the last operation:

$ but undo
Undoing operation...
  Reverting to: Restored from snapshot (2020-10-09 09:06:03)
 Undo completed successfully! Restored to snapshot: e0fedf918d39

Restoring to a previous point

You can easily restore to any point in the operations history by running the but oplog restore command. If it will modify your working directory (maybe it's just changes to the commit history or staging stuff), then it will prompt you if you want to continue. If you don't want that, you can pass -f or --force to make it do it anyhow.

$ but oplog restore -f 6fdd8fb1d547
 Restore completed successfully!

Workspace has been restored to the selected snapshot.

Restorations create a new oplog entry before running, so you can always easily undo it in the same manner.

It can be a bit confusing as to what state it restores to. It will restore to what your project looked like before the operation was run. So for example, if there is a CreateCommit operation and you restore to that SHA, it will put your state back to the moment before the commit happened.

Creating Snapshots

You can also manually create snapshots of moments that you want to be able to revert to at any point, without some other operation needing to automatically save it.

$ but oplog snapshot
Snapshot created successfully!
  Snapshot ID: 9284c8b886e2

💡 Use 'but oplog restore 9284c8b' to restore to this snapshot later.

Now you can copy that SHA and restore to that exact point at any time in the future.

Last updated on

On this page

Edit on GitHubGive us feedback