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
──────────────────────────────────────────────────
4cda12bada35 2020-10-09 09:06:03 [OTHER] UpdateDependentBranchName
d1476133c7a8 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
1d5b04818783 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
023ad7097a84 2020-10-09 09:06:03 [OTHER] FileChanges
656daa60a1b4 2020-10-09 09:06:03 [OTHER] FileChanges
adf5fdd6063d 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
6fb1ff4f970d 2020-10-09 09:06:03 [MOVE] MoveCommit
16764fa86c07 2020-10-09 09:06:03 [MOVE] MoveCommit
3ad3c80e6f9a 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
959786706044 2020-10-09 09:06:03 [UNDO] UndoCommit
5df0c2432140 2020-10-09 09:06:03 [UNDO] UndoCommit
bdde02349a6c 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
d631a98e7942 2020-10-09 09:06:03 [SQUASH] SquashCommit
b7e5e43add63 2020-10-09 09:06:03 [SQUASH] SquashCommit
d23bf8a49e09 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
93196b284b0a 2020-10-09 09:06:03 [AMEND] AmendCommit
6f9648947dfa 2020-10-09 09:06:03 [AMEND] AmendCommit
286080952594 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
659319f5da16 2020-10-09 09:06:03 [RESTORE] Restored from snapshot
37bf16a4c2b4 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: d1476133c7a8

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: c365b4e51872

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