Skip to content

Instantly share code, notes, and snippets.

@rdebeasi rdebeasi/shelve
Last active May 16, 2016

What would you like to do?
Simple equivalent of "git stash" for Subversion
# Simple equivalent of "git stash" in Subversion.
# This doesn't require creating branches (which can get messy) or using patches
# (which doesn't work if a visual diff tool is configured).
# More ideas:
# If any comamand fails, abort the script.
set -e
# Feel free to change this path to a directory of your choosing.
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
filename=$(basename $1)
if [ -z "$1" ]; then
echo "Please specify the name of the file to shelve."
cp $1 $shelf
# We're copying and *then* renaming rather than just doing one mv command so
# that text editors that have the file open don't start looking at the shelved
# version.
mv $shelf/$filename $shelf/$new_name
echo "Copied '$filename' to '$shelf/$new_name'."
svn revert $1

This comment has been minimized.

Copy link
Owner Author

rdebeasi commented Sep 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.