Two Guys Arguing

Notes to self: Keep SVN in sync w/ Git The Poor Man’s Way

Posted in Uncategorized by benjaminplee on 11.12.10

There is probably a much better/faster way to do this leveraging git-svn, but for the poor fool who has to keep an SVN repo in sync w/ the development Git repo for client consumption … here are a couple helpful one liners…

Copy from the Git repo directory to the SVN repo directory

rsync -r $GIT_DIR $SVN_DIR

Detect if there are any non-.svn folder differences between the directories after (good sanity check)

diff -r $GIT_DIR $SVN_DIR | grep -v '\.svn' | wc

5 Responses

Subscribe to comments with RSS.

  1. youngnh said, on 11.12.10 at 3:18 pm

    I’ve had to do this very thing, creating a tracking git repo of an active CVS project. be careful with your options here. without a –delete flag on rsync, you’ll only ever add files. if something is removed from SVN, you’ll never know and it could end up sticking around in your git.

    • benjaminplee said, on 11.12.10 at 4:27 pm

      Thanks for the tip about the delete flag. Luckily for the most part it is only one way to send to the client (ie we don’t need to pull back changes from SVN to Git)

  2. […] Tips: IE Caching Can Byte, Notes to self: Keep SVN in sync w/ Git The Poor Man’s Way, and Programming Anti-Patterns: Releasing Cthulhu.  Honestly, these were cop-out posts.  I know […]

  3. Jesse said, on 12.07.10 at 8:29 am

    You can simply have git and svn running in the same directory and update/commit on both VCS as needed.

  4. marc gonzalez carnicer said, on 08.04.16 at 11:25 am

    i have written a text about a similar way and i also named it “the poorman’s”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s