Named stashes

geirgp
geirgp
I've created a script to ease the stash->rebase->unstash cycle: #!/bin/bash git stash save git rebase origin/develop git stash pop This works as intended except for when there are no uncommited changes, in which case the first command will not create a stash and `git stash pop` will then delete the latest already exisiting (if any). To work around this i've been trying to find a way to name identify a stashes, but it seems that is not possible and they are always numbered like for instance `stash@{0}` for the most recent (and then increasing numbers for the older ones). Any thoughts? Thanks! Geir

Last updated

J66st
J66st
Hmm, the exit code of git stash does not say anything. What about something like: #!/bin/bash if (git stash | grep -q "^No local changes") then git rebase origin/develop else git rebase origin/develop git stash pop fi

1-2 of 2

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.

Post a reply
396 views