apply-stash
Apply a stash by searching for a partial match in the stash message. Instead of remembering stash numbers, you can use part of the stash description to apply the correct stash. For example, git apply-stash config will apply the most recent stash with "config" in its message.
Usage:
git apply-stash <partial-name>
CLI Command
git config --global alias.apply-stash "!f() { stash=$(git stash list | grep -i "$1" | head -n 1); if [ -n "$stash" ]; then stash_id=$(echo "$stash" | awk -F: '{print $1}'); echo "Applying $stash"; git stash apply "$stash_id"; else echo "No stash found matching: $1"; fi; }; f"
.gitconfig Snippet
[alias]
apply-stash = !f() { stash=$(git stash list | grep -i "$1" | head -n 1); if [ -n "$stash" ]; then stash_id=$(echo "$stash" | awk -F: '{print $1}'); echo "Applying $stash"; git stash apply "$stash_id"; else echo "No stash found matching: $1"; fi; }; f