# git stash drop: Usage, Options & Common CI Errors

> git stash drop deletes a single stash entry; clear removes them all. Reference for stash@{n}, recovery via reflog, and the no-such-entry error in CI.

Source: https://latchkey.dev/learn/command-reference/git-stash-drop  
Updated: 2026-06-25

git stash drop removes one stash entry from the stack without applying it.

Drop is how you discard a stash you no longer need, or clean up after a conflicted pop. It is destructive, but a dropped stash is briefly recoverable through the stash reflog.

## What it does

git stash drop deletes the specified stash entry (the latest by default) from the stack. git stash clear deletes every entry at once.

## Common usage

```Terminal
git stash drop                  # drop stash@{0}
git stash drop stash@{2}
git stash clear                 # remove all entries
# recover a just-dropped stash:
git stash apply <sha-from-stash-reflog>
```

## Options

| Item | What it does |
| --- | --- |
| [<stash>] | Drop a specific entry (default: stash@{0}) |
| clear | Remove all stash entries |
| -q / --quiet | Suppress output |

## Common errors in CI

fatal: <stash> is not a valid reference - the index is out of range or the stack is empty. List first with git stash list. A dropped or cleared stash is not immediately gone; its commit lingers in the stash reflog until gc, so recovery is possible with git fsck --unreachable or the reflog SHA.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### git stash drop: Usage, Options & Common CI Errors?

Drop is how you discard a stash you no longer need, or clean up after a conflicted pop. It is destructive, but a dropped stash is briefly recoverable through the stash reflog.

### What it does?

git stash drop deletes the specified stash entry (the latest by default) from the stack. git stash clear deletes every entry at once.

### Common errors in CI?

fatal: <stash> is not a valid reference - the index is out of range or the stack is empty. List first with git stash list. A dropped or cleared stash is not immediately gone; its commit lingers in the stash reflog until gc, so recovery is possible with git fsck --unreachable or the reflog SHA.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
