Skip to content

Instantly share code, notes, and snippets.

@naufraghi
Created August 12, 2011 09:20
Show Gist options
  • Save naufraghi/1141760 to your computer and use it in GitHub Desktop.
Save naufraghi/1141760 to your computer and use it in GitHub Desktop.
git svn outgoing | rebase-all | dcommit
git-svn-outgoing() {
need_stash=$(git st --por | cut -c 1-2 | grep M | cat)
if [ "$need_stash" ]; then
git stash > /dev/null
fi
git svn dcommit -n | grep diff-tree | while read line; do git show $(echo $line | cut -d' ' -f 3); done
if [ "$need_stash" ]; then
git stash pop > /dev/null
fi
}
_git-svn-action-all() {
action=$1
path=$2
echo "Working in path" $(readlink -f -n $path)
for dir in $(find $path -name ".git" -exec dirname {} \; | sort); do
cd $dir
echo "--------------------------"
echo $dir
echo "--------------------------"
need_stash=$(git st --por | cut -c 1-2 | grep M | cat)
if [ "$need_stash" ]; then
git stash
fi
git svn $action
if [ "$need_stash" ]; then
git stash pop
fi
cd - > /dev/null
done
}
git-svn-rebase-all() {
path=${1:-.}
_git-svn-action-all rebase $path
}
_git-svn-action() {
action=$1
need_stash=$(git st --por | cut -c 1-2 | grep M | cat)
if [ "$need_stash" ]; then
git stash
fi
git svn $action
if [ "$need_stash" ]; then
git stash pop
fi
}
git-svn-dcommit() {
_git-svn-action dcommit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment