Skip to content
GitTree
History and recovery

Find previous branch tips

The reflog records where a branch or HEAD pointed, every time it moved: commits, checkouts, resets, rebases. View Reflog… lists those entries; choose one to show its commit in the graph or Restore as Branch.

FreeUpdated

Works in GitTree Free: every local Git feature, once you are signed in.

On this page
  1. Before you start
  2. Where to find it
  3. Steps
  4. Expected result
  5. Try Undo first
  6. If something goes wrong
  7. Questions
  8. Related

Before you start

  • The commits you are looking for were on your computer: the reflog is local and is not pushed or fetched.

Where to find it

  • The command palette: View Reflog….
ActionmacOSWindows and Linux
The command palette, then View Reflog…⌘⇧PCtrl+Shift+P

Steps

  1. Open the reflog

    Run View Reflog… and choose the reference under Reflog of, such as HEAD or a branch. Show Older Entries loads more.

  2. Find the entry

    Each entry says what moved the reference and when. Choose the one from before the change you want to undo.

  3. Look or restore

    Show in Graph selects that commit. Restore as Branch creates a branch there: type a New branch name and confirm.

Expected result

GitTree says Created branch …. Undo removes it again. The lost commits are reachable from that branch.

Try Undo first

For a step you took in GitTree, Undo is quicker: it reverses the last operation exactly (undo and redo). The reflog helps with older steps and with ones taken in a terminal.

If something goes wrong

“This reference has no reflog.”

Git keeps reflogs only for references that moved in this repository; a branch fetched but never checked out may have none. Try HEAD’s reflog.

Questions

How long does the reflog keep entries?

Git’s default keeps them for about 90 days, until garbage collection expires them.