Skip to content

Instantly share code, notes, and snippets.

@Tug
Created February 15, 2016 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tug/ac5fdd82e950ddcfb59b to your computer and use it in GitHub Desktop.
Save Tug/ac5fdd82e950ddcfb59b to your computer and use it in GitHub Desktop.
simple svn stash aliases and function
alias svn-stash='svn diff | pb >> ~/.svn_stack && svn revert -R .'
alias svn-stash-list='cat ~/.svn_stack'
function stash_pop() {
line=$(grep -n "$1" ~/.svn_stack | cut -d : -f 1)
if [ -z "$line" ]; then
line=$(wc -l < ~/.svn_stack)
fi
pastebin_url=$(sed "${line}q;d" ~/.svn_stack)
if [ -n "$pastebin_url" ]; then
pb "${pastebin_url}" | patch -p0
sed -i "${line}d" ~/.svn_stack
fi
}
alias svn-stash-pop=stash_pop
@Tug
Copy link
Author

Tug commented Feb 15, 2016

Example of usage:

  • svn-stash
  • svn-stash-list
http://pastebin.com/ABCD123
  • svn-stash-pop ABCD123 or svn-stash-pop (for last one added)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment