Created
April 22, 2013 19:42
-
-
Save ddbeck/5437873 to your computer and use it in GitHub Desktop.
A shell script and alias to avoid making dumb mistakes with git-svn.
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
[alias] | |
ci = commit | |
co = checkout | |
st = status | |
wdiff = diff --color-words | |
svnci = !$HOME/src/dotfiles/git-svn-safe.sh dcommit | |
svnre = !$HOME/src/dotfiles/git-svn-safe.sh rebase |
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 | |
branch=$(git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3) | |
if [[ $branch = "master" ]]; then | |
output=$(git svn "$@" 2>&1 | tee /dev/tty) | |
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
Consider this untested for platforms other than Mac OS 10.6.