Created
May 20, 2016 14:32
-
-
Save ddbeck/29bb1ea4b42de3841428abc5f0dcc563 to your computer and use it in GitHub Desktop.
This file contains 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
# modify your .gitconfig to include these in the alias section | |
[alias] | |
svnci = !$HOME/bin/git-svn-safe.sh dcommit | |
svnre = !$HOME/bin/git-svn-safe.sh rebase | |
svnsync = !git svnre && git svnci |
This file contains 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
#!/usr/bin/env bash | |
# this file goes in #$HOME/bin/ or someplace convenient like that | |
branch=$(git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3) | |
if [[ $branch = "master" ]]; then | |
output=$(git svn "$@" 2>&1 | tee /dev/tty) | |
# provide a summary of revisions committed | |
count=$(echo -e "$output" | grep -c "^Committed") | |
if [[ $count > 0 ]]; then | |
echo -e "\nLog of $count commits:" | |
git svn log --reverse --oneline -n"$count" | \ | |
sed -E 's/^(r[0-9]+) [|]/\1:/' | |
fi | |
else | |
echo Avoid runing git svn "$@" on a branch other than master. | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment