Skip to content

Instantly share code, notes, and snippets.

@infotexture
Created February 10, 2010 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infotexture/300214 to your computer and use it in GitHub Desktop.
Save infotexture/300214 to your computer and use it in GitHub Desktop.
Cornerstone Post-Commit Action Script
#!/bin/bash
# Cornerstone Post-Commit Action Script <http://www.zennaware.com/cornerstone/>
# Get last log item from working copy's history & copy it to the pasteboard
# $1 is used to reference the POSIX path of the working copy that was committed
/usr/local/bin/svn log "$1" -r HEAD --limit 1 --verbose | pbcopy
# infotexture hooks for hybrid Git/Subversion working copies. Created 2010-02-09
# (see <http://infotexture.net/2010/02/git-to-svn-and-back-again/> for details)
# Rebase won't run if there are uncommitted changes in your working tree, but
# Force-overwriting modified files in the Git working copy could be dangerous:
# git checkout HEAD --force
# Instead, save any modified tracked files and staged changes to a stash
# for safe keeping. You can view stored stashes later with `git stash list`
# or delete all of the stored stashes with `git stash clear`.
cd "$1"
/opt/local/bin/git stash save "Changes stashed before rebase by SVN post-commit script"
# NOTE: Stashing won't save untracked files or folders added via Subversion,
# but they're safe in SVN, so we can safely force-delete them to enable rebase,
# (which will bring them back). The -d option also removes any untracked directories.
/opt/local/bin/git clean --force -d
# Get the latest changes from the remote Subversion repository:
/opt/local/bin/git svn rebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment