2008-07-18

The adventures with Git continue

Neil answered my questions (as did people who left comments on my last post; thanks) and so I learned a few things. One, is if you want to see what is going to be committed to a svn repository, use ``git log git-svn..`` (do notice the trailing dots!). You can also use ``git show`` to get a diff of the last commit. To see the differences between HEAD and the current state of the files you use ``svn diff HEAD^`` (the "^" means "previous", and I believe you can just keep tacking those on to go as far back as desired).

OK, so now I can confidently see what I will be pushing to Python's svn repository. So I do ``git svn dcommit`` and find out that someone has changed Misc/NEWS and that I need to merge first. OK, so I do ``git fetch git-svn`` followed by ``git merge git-svn``. Oops, that last command was not the right one.

Unlike other DVCSs, Git prefers you use "merge" when you have not changes and "rebase" when you do. So I messed up by not using ``git rebase``. Fine, screw-ups happen; I just need to resolve the conflicts now in Misc/NEWS, right? Heh, I wish.

I fix the file and try to do ``git resolve Misc/NEWS``; turns out that is not a command. Fine, I try ``git commit Misc/NEWS``; can't do a partial commit during a conflicted merge. I try ``git commit``; "error: Error building trees". What is up with this program!

But I am determined to make this work, so I continue to poke around. I find ``git reset``. Turns out I want ``git reset --hard`` to ditch the changes. I do that, do the proper "fetch; rebase" dance, fix the conflict, do a ``git add``, and then continue the rebase. So now everything seems fine.

But then I still can't commit. When I run ``git svn dcommit`` it complains that Mac/IDLE/Makefile.in is out of date:

Committing to svn+ssh://svn.python.org/python/trunk ...
M Mac/IDLE/Makefile.in
Transaction is out of date: Out of date: '/python/trunk/Mac/IDLE/Makefile.in' in transaction '65108-1' at /unix/bin/git-svn line 461
The joke of it all is that I didn't touch that file, nor does Git say I touched it. Looks like git-svn is just deciding to screw with me at the wrong time.