Skip to content

Instantly share code, notes, and snippets.

@lionicsheriff
Created October 17, 2012 23:00
Show Gist options
  • Save lionicsheriff/3908886 to your computer and use it in GitHub Desktop.
Save lionicsheriff/3908886 to your computer and use it in GitHub Desktop.
I should be more careful
function revert_last_commit()
{
read -p "Are you sure you want to revert the last commit?[y/N] " -n 1 answer
echo
if test $answer = 'y'
then
svn up
local head="$(svn info | grep Revision | cut -d' ' -f2)"
local prev="$(expr $head - 1)"
svn merge -r $head:$prev .
svn commit -m "Revert last commit"
svn up
head="$(svn info | grep Revision | cut -d' ' -f2)"
prev="$(expr $head - 1)"
svn merge -r $head:$prev .
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment