git
stash
creation date
version control
git stash

Get the creation date of a stash

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Git stashes are stored as commits under refs/stash, so they do have timestamps even if the default git stash list output does not emphasize them. The practical solution is to use stash listing with log-style date options or inspect the stash reflog directly.

The Quickest Command

Because git stash list accepts log options, you can usually ask it to show dates immediately.

bash
git stash list --date=local

You can switch the display style with any supported Git date mode, such as --date=iso or --date=relative, depending on how precise you want the output to be.

This is the simplest answer when you just want to see when recent stashes were created.

Use the Stash Reflog for More Detail

Under the hood, stash entries are tracked through a reflog. If you want a fuller history view, inspect that reflog directly.

bash
git reflog show stash --date=local

This often gives a clearer picture than the regular stash list because it shows the stash history as reflog entries with timestamps. If you want a more customizable output format, git log -g works well too.

bash
git log -g --date=iso --format='%gd %ci %gs' refs/stash

That prints the stash reference, commit date, and stash message in a compact form that is easy to scan.

Inspect One Specific Stash

If you already know which stash you care about, show the metadata for that single stash entry.

bash
git show --no-patch --format='%ci %s' stash@{1}

This is useful when the stash list is long and you do not want the full history. A stash reference such as stash@{1} points to a normal Git object, so log formatting works the same way it does for other commit-like objects.

If you want an even lower-level inspection, this also works:

bash
git cat-file -p stash@{1}

That confirms a stash is stored as a commit object with normal commit metadata and parent references.

Understand What Date You Are Looking At

In normal usage, the date you see is the commit date of the stash object, which corresponds to when the stash was created. If you later add or drop other stashes, the numbering such as stash@{0} changes, but the underlying stash commit date does not.

That is why stash indexes are convenient labels, not stable identities. If the stash matters, pairing the date with the stash message is much more reliable than depending only on the current numeric position in the stack.

Use Messages So Dates Are Not Your Only Clue

Creation date is helpful, but it becomes much more useful when each stash has a descriptive message.

bash
git stash push -m "wip api migration"
git stash list --date=local

Without messages, a list of old stash entries becomes hard to interpret even if you can see the timestamps. Good messages reduce the need to inspect each stash manually.

Common Pitfalls

  • Assuming stash entries have no timestamp because the default output does not highlight it.
  • Forgetting that stash@{0} style indexes shift when stashes are added or dropped.
  • Inspecting the wrong stash because the numbering changed.
  • Treating a stash as something separate from ordinary Git commit metadata.
  • Relying on timestamps alone instead of giving stashes useful messages.

Summary

  • Stashes do have creation dates because they are stored as commit objects.
  • Use git stash list --date=... for the fastest answer.
  • Use git reflog show stash --date=... or git log -g refs/stash for a fuller history view.
  • Use git show --no-patch --format=... stash@{n} for one specific stash.
  • Add descriptive stash messages so timestamps are not the only identifying detail.

Course illustration
Course illustration

All Rights Reserved.