Skip to content

Undo anything

MyTwig is built so you can try things. Most actions can be taken back with ⌘Z, and put back again with ⇧⌘Z or ⌘Y.

  • commits and amends
  • pulls, merges and rebases, including interactive rebases
  • checkouts
  • creating, renaming and deleting branches
  • stashing, snapshots, popping and dropping stashes
  • discarding files or lines
  • absorb, split commit, patches and restacks

After many actions a toast at the bottom of the window says what happened, with an Undo button. The toast stays while your pointer is over it.

Before discarding a file or some lines, MyTwig saves what it had in a hidden ref under refs/mygit/discarded/, outside the graph. That’s what makes discard undoable.

Every operation that rewrites branches or throws work away first saves the repository as it was. Operation Timeline (in the Repository menu and the palette) lists those states, newest first.

Choose one and click Restore This State…. MyTwig shows exactly what will change: which branches move, come back or are deleted, and which files change. Restoring puts back your local branches, what’s checked out, what’s staged and your working tree. Remote branches, tags and stashes are left alone. The current state is saved first, so you can undo the restore too.

View → Reflog shows every move of HEAD, including commits no branch points to anymore. Right-click one to make a branch there.