Thursday, September 19, 2013

Simple Git SVN

I'm a huge fan of Git. I use it at home, at work; just about anytime I want to keep an easy history of things I'll break out a simple 'git init .' and be on my way to Git nirvana. Unfortunately, not all development organizations use Git. But alas, there's still hope! If you happen to find yourself in a group that uses Subversion, never fear, git-svn is here. Here's a breakdown of my basic workflow.

Initializing a New Local Git Repo From Subversion


Method 1 - not using the svn standard /trunk /branches /tags off of project root


  1. git svn init /path/to/your/project/root
  2. git svn fetch

Method 2 - using the svn standard /trunk /branches /tags off of project root


  1. git svn init /path/to/your/project/root -s
  2. git svn fetch

During the init, you might notice a message about "using higher level of URL." This is normal.


Submitting an Existing Git Repo Into Subversion


Method 1 - not using the svn standard dir structure

  1. svn mkdir --parents /path/to/your/project/root/
  2. git svn init /path/to/your/project/root
  3. git svn fetch
  4. git rebase trunk

Method 2 - using svn standard dir structure for a project

  1. svn mkdir --parents /path/to/your/project/root/trunk /path/to/your/project/root/branches /path/to/your/project/root/tags -m "standard svn project folders"
  2. git svn init /path/to/your/project/root -s
  3. git svn fetch
  4. git rebase trunk

Committing Changes
  1. git add -A
  2. git commit -m "adding my changes, including new files"
  3. git svn dcommit
  4. git log

Monday, May 27, 2013

Chartmix Now Available on GitHub!

I decided to write a simple Python script to pull the latest music from the Billboard Hot 100 list and create a playlist on Grooveshark. Fork me on GitHub - https://github.com/clevelandflash/chartmix

Monday, June 20, 2011

Making a Navigable Table of Contents in Vim

I love Vim. I never thought I'd say this, seeing as a decade ago I was strictly a notepad/Word guy, but I really like Vim. There is no doubt a learning curve, but it's well worth the effort.

Today I decided to create a simple document with a table of contents with a document in Vim. Text editors like Google Docs provide internal linking structures, but in Vim it's much, much simpler. Simply create a TOC with one item per line like the following:
>>SECTION_1<<
>>SECTION_2<<
    >>SECTION_2_a<<
>>SECTION_3<<
>>SECTION_4<<
    >>SECTION_4_a<<
    >>SECTION_4_b<<
>>SECTION_5<<

Once you create your TOC, it's really easy to navigate about your document. Simply move the cursor to the line in your TOC that you'd like to find in the main document, then hit the asterisk "*" key. Vim will find the closest word following the cursor's current location on the line and then search for the next value in the document that matches that word. You'll also notice I've used underscores in my section headings. The reason for this is that Vim will treat underscores as part of a word, rather than as a delimiting character like a space or hyphen. Does it get any simpler than this?

Cheers,
~Mike