vcs

SVN2Git and "fatal: bad default revision 'HEAD'"

I was recently converting a repository from SVN to Git using KDE's SVN2Git, and after the conversion was done, the repository didn't seem to work that well. Inside the bare repo, if I tried git log, I received:

fatal: bad default revision 'HEAD'

I also tried git fsck, which resulted in:

notice: HEAD points to an unborn branch (master)

After trying a few different methods to resurrect the git repository, I noticed that my SVN2Git rules file defined the name of the resulting git repository as example-example (note the dash). Removing the dash fixed the issue, and now I have a happy git repository!

tl;dr: Don't use special characters in the name of the resulting git repository in SVN2Git's rules file.

Switching an SVN repository to Git with KDE's Svn2Git

Some places where I've worked have used SVN for version control, and while the supposed simplicity and centralization of SVN can be nice in certain situations, SVN can't hold a torch to Git's speed, flexibility, and ubiquity (nowadays) for source control. Not to mention SVN doesn't have real tags or branches, just quasi-directories that can easily be mangled into a horrific mess (I see this quite often).

I've had to use some incredibly large (10,000+ revisions, 2GB+ total size) SVN repositories, and while I've managed them using git svn sometimes (see Switching an SVN repository to Git using git svn), it's much nicer to be able to migrate the entire team from SVN to Git so everyone can work on the repository much more efficiently.

Stop letting .DS_Store slow you down

I have over 100 git repositories on my Mac, and for almost every one, I sometimes browse the directory structure in the Finder. Once I do that, I inevitably end up with a few pesky .DS_Store files that want to be added to my repo:

Pesky .DS_Store Files in Terminal during Git Status

.DS_Store files don't add anything of value to my code (they just tell Mac OS X about folder display and icons), so I always end up adding them to my own projects' .gitignore files. But when I'm working on other repositories (like Drupal, or a fork from GitHub) I don't want to add a .gitignore if none exists, or mess with the project's existing .gitignore. So what's a coder to do?

There are a couple good solutions: