|
![](/i/fill.gif) |
My version control system of choice is Darcs. But obviously nobody
actually uses that. I gather a number of people do use Git, however. And
NetBeans has Git capabilities built-in.
I did look to see where it installs the Git binaries. It doesn't. It
uses JGit, a complete reimplementation of Git in Java. (This makes me
nervous... How do we know the two implementations work the same way?)
So anyway, I downloaded the /real/ Git implementation, which comes with
some visualisation tools. (NetBeans does a really useless job of showing
you the current state of your repository. It shows you the ID of the
current commit and that's about it.)
I had another look over "Understanding Git"
http://www.eecs.harvard.edu/~cduan/technical/git/
If I'm understanding this correctly, history is stored as commit
objects, which one storing the complete state of the entire codebase,
plus the IDs of its ancestor commit(s). The "branches" or "heads"
themselves are merely bookmarks into this tree of commits. They let you
conveniently get from place to place and label your stuff, but you can
create new ones or destroy existing ones at will. The commits themselves
are the actual history.
So far, that understanding hasn't caused me too many problems. And I
quite like the way that a single repository holds multiple branches.
Darcs follows an "every repository /is/ a branch" mentality. Which
works, but makes it kinda long-winded to change branches. In NetBeans, I
can click "switch branch" and all my code suddenly changes.
OTOH, it's irritating to have to switch branches, click "merge
revision...", select the branch I was just on, and then switch back
again every single time I want to update one branch to match another. I
imagine this is a limitation of the NetBeans, and if I used Git directly
there would be a command to immediately update a branch without actually
switching to it.
One extremely irritating issue is that it's apparently impossible to
create a commit object of a completely empty repository. So there can
never be a branch where you start again from scratch. Every branch must
always start out with /something/ in it. I suppose I could just create a
dummy file to create commit 0, and then delete it again. But it's
irritating.
Rather /more/ irritating is this: I made a commit, and then realised the
description was wrong. (NetBeans defaults to using the exact same
description as the previous commit - because that's SO USEFUL, right?)
So I looked for the command to undo the last commit. Apparently there
isn't one. I even found a question on Stack Overflow about it. Lots of
people suggesting various complex workarounds to try to solve it, but
nothing that says "just delete the last commit object!"
Using the GUI, I was able to create a /new/ commit object identical to
the old one but with a different description. The old commit object is
still there though, showing up is a dangling branch. And I cannot find
any way to get rid of it. It's all very annoying.
(I could mutter something about how in Darcs this problem takes about 15
seconds to fix... But what would that prove?)
One mildly niggling thing is that Git imposes an artificial order on
things. Like, with Darcs, if I edit file X, and then make some
completely unrelated change to file Y, then as far as Darcs is
concerned, there is no ordering relation between these unrelated
changes. But to Git, one commit is descended from the other, even though
there's no logical relationship.
Conversely, with Darcs, if I edit file X to add a new function, and then
edit file Y to /use/ that new function, then Darcs doesn't see any
relationship, but there /is/ one, and Darcs' idea that the two changes
are unrelated is flat-out wrong. Then again, shouldn't you be recording
those two changes in the same commit?
The way Git does things does have the advantage that a situation like
this just never happens. On the other hand, if I change file X on one
branch and file Y on another branch (so the changes are /definitely/
unrelated), you still have to "merge" the changes to get back to a
single branch. To Darcs, this would just be adding in a few more
changes. Still, it seems to /work/ just fine, so who's complaining?
All of this stuff gets /much/ easier to follow with gitk to show me WTF
is actually happening. Unfortunately, Git seems to be a Unix
application, meaning that you cannot install it without first installing
a Unix emulator. The default installer binary seems to install MSYS,
including Bash, Perl, Tk, and a whole bunch of other stuff. *sigh*
Post a reply to this message
|
![](/i/fill.gif) |