Can I set hooks for “pull”/”push”ing from/to a git-svn managed repository?
The situation is that I have a project host on Google Code, and use git to manage the local working copy. I want to set some hooks so that when checking in/out data from/to the SVN repository with git svn fetch and git svn dcommit, I can do some modification to the commit. Since I do not host the SVN repository, I can’t set hooks on the server side.
Is there any hook I could use? Or is there a way to “mark” an ordinary branch, so that git pull and git push on that branch will check in/out from/to a SVN repository instead, therefore the normal git hooks could be used?
Thanks in advance.
As illustrated by this thread, you can have hooks on the Subversion side which can actually reject your
git svn dcommitbased on some criteria.But if you need git hooks on the Git side, I would recommend setting up an intermediate bare Git repository (bare for easy push/pull).
On that bare repo, you can have any hook you need, as shown in "how do I deploy multiple branches to different directories via git push?" (not about svn but just here to detail a similar setup of an extra repo)
git svn dcommit.git fetchrequest, trigger agit svn fetchand validate it, before allowing your owngit fetchto move forward.(2 years later)
David Souther proposes a solution in his blog (April 2012)
stagewill let us keep the working directory clean and in sync with downstream changes.Check out his gist.