4
echo "Invalid arguments!"
5
echo "$0 <commit to revert>"
9
if [ -n "$(git status -uno -s --porcelain)" ]; then
10
echo "You have unstashed changes. Please stash and then revert."
17
SVN_REVISION=$(git svn find-rev "$COMMIT")
19
echo "Error! Could not find an svn revision for commit $COMMIT!"
23
# Grab the one line message for our revert commit message.
24
ONE_LINE_MSG=$(git log --oneline $COMMIT -1 | cut -f2- -d " ")
27
git revert --no-commit $COMMIT 2>/dev/null
29
echo "Error! Failed to revert commit $COMMIT. Resetting to head."
34
# Create a template in our .git directory.
35
TEMPLATE="`git rev-parse --git-dir`/git-svn-revert-template"
37
Revert "$ONE_LINE_MSG"
39
This reverts commit r$SVN_REVISION.
42
# Begin the commit but give our user an opportunity to edit it.
43
git commit --file="$TEMPLATE" --edit
45
echo "Error! Failed to commit reverting commit for commit $COMMIT. Reverting to head."