After a little hacking session and some unpleasant ruby 1.8.6 vs 1.8.7 fun, I ran into another interesting tidbit about git. As with most powerful tools it will gladly allow you to blast your foot off. Wouldn't ya know, my aim was well aligned with my feet a few moments ago. git checkout some/remote_branch. I thought I was switching over to a remote branch I'd created on another machine, so that I could test and work on this other machine. Little did I know that I had entered the "(no branch)" state. At this point I was pretty much gunning to create orphaned blobs, commits and other such items. After creating a few, I wanted to push those changes to the upstream server (github in this case) after merging them into the HEAD.

After checking out the master branch, I quickly found out that my little "(no branch)" wasn't reachable. A little poking around git rendered, git fsck --lost-found, which will identify orphaned commits and entities. Once you find the commit id you can checkout the master branch again and git merge my-lost-commit-id.

me and my git-svn

April 3rd, 2008

I recently switched a bunch of my projects over to git. Why? All the cool kids are doing it, I figured I'd give it a shot. Either way I ran into a few bumps with the git-svn stuff. Everything went really well until I tried to push back my changes from git. I'd been committing changes to my repo and pushing them to github/hasno without issue. I ran into errors when I tried to git-svn dcommit.

Here's what I'm currently calling the right way, as usual ymmv:

  1. init if you haven't done i already, check .git/config for an svn-remote entry...
    git-svn init <repo url>
  2. pull the svn revision information. a bunch of info should scroll by matching svn revisions to git sha1 revisions.
    git-svn fetch
  3. this will yeild a list of local & remote branches, you should see trunk in the list
    git branch -a
    * master
      origin/HEAD
      origin/local-svn
      origin/master
      tags/release-0.1.23
      tags/release-0.2.42
      tags/release-0.2.44
      tags/release-0.2.50
      trunk
       
  4. switch to a local branch based on the trunk remote branch
    afaik you really don't want to be doing any of this type of stuff in a remote branch
    git checkout -b local-svn trunk
  5. now we need to pull your local changes from your master branch to your local-svn branch
    git merge master
    it's worth noting that you could do a git rebase, but when I tried that I couldn't use git-svn dcommit
  6. go through and merge any conflicts. then git commit. at this point you can git dcommit

So if all that was how I got it working, what did I run into along the way... Well I'm glad you ask. Here's a list of errors and the reason for them afaik:

Unable to determine upstream SVN information from HEAD history
You have a recent commit that doesn't have any history in .git/ref/remote/svn or .git/svn. It also doesn't have the git-svn-id: key in the commit message.
[svn-remote "svn"] unknown
Did you manually create the svn-remote entry, or specify a different name? If so you need to pass that on to the commands, they seem to assume it's named svn.
fatal: bad default revision 'refs/remotes/git-svn'
Somethings amiss with your svn-remote entry in .git/config

That's about it for me, if you've seen those errors and can add some detail or shed some light on a better way please do share. As of this moment ruby-hl7 is synched up.