Check and clean git stashes with dates
Posted on: Tuesday, Jun 14, 2016
When working with git stashes, your stash list may get filled with old savepoints from the past. This surely happens when you do not pop the stashes when using them. At one point, you may want to clean this list of stashes and check how old the stashes actually are to make sure they can be deleted.
You can check the dates of each stash in the list using the following command
git stash list --date=local
Do you want to try other date formats? You can see other options here.
Have a specific stash you want to view the date and other details? Use the following command, specifying the stash number between the brackets:
git show stash@{0}
Once you are sure you can remove your saved stashes, use the following command to clear all or specific stashes:
All stashes at once (make sure that you want to do this!):
git stash clear
Specific stash:
git stash drop stash@{0}
More information can be found on https://git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning
- Tags: cli, development, git, stash
- No Comments