Created
February 15, 2016 13:09
-
-
Save Tug/ac5fdd82e950ddcfb59b to your computer and use it in GitHub Desktop.
simple svn stash aliases and function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example of usage:
svn-stash
svn-stash-list
svn-stash-pop ABCD123
orsvn-stash-pop
(for last one added)