Git locally, Subversion Repos

Whilst learning how to use git with svn starting from a new item in the trunk, I’ve hit a couple of snags and am documenting the way I should have done it.

  • Create your new working directory and add it to svn first: mkdir efot && svn add efot && svn commit efot -m "starting the new project"
    (Note the revision number for later)
  • Make sure svn will ignore git files: svn ps svn:ignore ".git" efot
  • Now we go to setup git: cd efot
  • Initialise git: git svn init https://svnServer/repos/section/trunk/efot
  • Get the right revision from svn using the revision number you got in 1: git-svn fetch -r2424
  • Make sure everything is really, really, really ready ;): git-svn rebase
  • Make sure git ignores .svn:
    • vim .git/info/exclude
    • add “.svn” (without the quotes) to the bottom of the file
    • save and quit.
  • At this point you’re ready to go. Create your usual directory structure and add it to git: git add .
  • Do your first commit to git: git commit
  • Add a file: touch showMe.txt
  • add to git: git add .
  • commit to git: git commit -a
  • update from svn: git-svn fetch
  • if any come in on teh fetch, replay your git changes onto it: git-svn rebase
  • commit to svn: git-svn dcommit

Job’s a good’un. Thanks to Flavio Castelli

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

w

Connecting to %s