With the Reflog, Git keeps a journal of many important actions. A new log entry is created every time your HEAD branch pointer is moved: e.g. when checking out a branch, merging changes, performing a cherry-pick or a reset. This can come in very handy for reconstructing past actions and recovering "lost commits". This makes it a great "security net" for your Git repository.
Since it is quite an advanced tool, Tower does not show it by default - but allows you to enable it in Tower's preferences.
You can access it either via the ⌘ + 5.item in the sidebar (after it was enabled in the preferences), or simply by pressing
A Basic Understanding of the Reflog
The Reflog records every reference change of your
HEAD. This makes it a kind of journal of your actions inside the repository, recording every action in sequential order.
Reflog entries expire and are deleted by the Git garbage collection. With default Git settings, an entry can expire after 30 days.
Working with the Reflog
By default, Tower displays all available Reflog entries for the
HEAD pointer. Alternatively, if you're searching for an action that happened while on a specific branch, you can switch the context to only display actions on that branch (simply select the branch by clicking the "HEAD" label above the item listing).
Restoring a Commit / Branch
In case you want to restore an old commit that you found in the Reflog, simply right-click that item and select.
Restoring Changes from a Commit
If you don't want to (re-)create a whole branch, you can also apply only a commit or even only parts of a commit.
- To cherry-pick an individual commit, simply drag and drop it onto your HEAD branch in the sidebar.
- To apply only parts of the commit's changes, drag and drop only that particular change (from the changeset of a selected Reflog item) onto the Working Copy item in the sidebar.