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
──────────────────────────────────────────────────
e16021d339a2 2020-10-09 09:06:03 [OTHER] UpdateDependentBranchName
b0f492536a38 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
6ac172bcd27e 2020-10-09 09:06:03 [INSERT] InsertBlankCommit
92a40ac9b19f 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
74862403ab1c 2020-10-09 09:06:03 [OTHER] FileChanges
f22383e0493c 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
c009517b354c 2020-10-09 09:06:03 [MOVE] MoveCommit
f33a43433210 2020-10-09 09:06:03 [MOVE] MoveCommit
785eaf5b8ec5 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
cca556351442 2020-10-09 09:06:03 [UNDO] UndoCommit
020eaf3a565c 2020-10-09 09:06:03 [UNDO] UndoCommit
14568d7f9e9d 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
a90094763410 2020-10-09 09:06:03 [SQUASH] SquashCommit
2b4f05e9c18e 2020-10-09 09:06:03 [SQUASH] SquashCommit
38202db7e609 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
a1a7361b9d81 2020-10-09 09:06:03 [AMEND] AmendCommit
357dd95433c0 2020-10-09 09:06:03 [AMEND] AmendCommit
784d1964e6c4 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
995bed5ffd5d 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
2e89b508f5fd 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: b0f492536a38

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: 25820fb040f2

💡 Use 'but oplog restore 25820fb' 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