Skip to content

Instantly share code, notes, and snippets.

@Thesharing
Forked from jdforsythe/git-rename-stash.sh
Created August 23, 2019 07:40
Show Gist options
  • Select an option

  • Save Thesharing/a6ebb83a685d8edf2b1c3e0c847db9d6 to your computer and use it in GitHub Desktop.

Select an option

Save Thesharing/a6ebb83a685d8edf2b1c3e0c847db9d6 to your computer and use it in GitHub Desktop.
Rename Git Stash
#!/bin/bash
git stash list
echo "Enter stash number to rename"
read stash_number
echo "Enter new name"
read new_name
stash_name="stash@{${stash_number}}"
echo "$stash_name"
rev=$(git rev-parse $stash_name)
git stash drop $stash_name || exit 1
git stash store -m "$new_name" $rev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment