the more i think about my previous answer the more i'm thinking that
it might have been just a cop-out and not true to heart.
if there's one thing that i don't like about svn it's the branching
and i think this is where git could help us. now i don't know how the
rest of the world programs, but even when i used svn, i use branches a
lot. to me, unless you're fixing a quick and down and dirty bug, you
should be working on a branch and not off trunk (master in git). my
whole reason for it is because trunk should always be in a working
state and if you're working on a feature of fixing a mess loads of
bugs, it could leave trunk in an unstable state. also because, when i
program websites, trunk matches what has been pushed to or going to be
pushed to production.
after working on my feature in a different branch, i merge it back
onto trunk and push it live. that all happens in theory with svn. in
reality i'm sitting at my desk for around 2 hours kicking, screaming,
crying and feverishly trying to get the branch that i've been working
on for the last week and a half merged back onto trunk. most merge
sessions with svn ended with me opening a bottle of patron silver and
pack of parliaments and punishing my liver and lungs. it was never
pretty and never easy. this was probably the reason why i only ever
worked on about 2 branches max. i just couldn't keep going through the
stress of merging svn branches, i just couldn't.
let's hop over to git now and see why this hot, spicy, sexy goddess of
the scm world has become my new arm candy. now i said above i only
worked with at most 2 svn branches at a time because of the problem
with merging. i don't have this issue with git. in fact i don't think
i've worked with only 2 branches since using git, i'm usually using
around 8 or 9 most of the time. in fact, i pretty much create a branch
of just about everything i do with git. need to fix a bug, branch,
need to add a feature, branch, add a comment, branch. i branch more
then i breathe now because git make merging these branches painlessly
easy. If something goes wrong I just "git reset --hard HEAD@{1}" and
try the merge again. i'm not afraid of messing anything up.
also did i mention that creating a branch with git is almost instant
as opposed to dismal with svn.
the other thing i can stand about svn is the total restrictions on how
you commit your changes. for instance, take a moment and look one of
the recent commits:
http://code.google.com/p/cfwheels/source/detail?r=3106
notice what the commit message saids "fixed issue 271 and refactored
code". so you're all looking at this right now and saying, "so what's
the big deal". well i'll tell you what the big deal is, that one
commit should be two commits. one for the fix and one for the
refactor. now i bet the reason why it's in one commit was because the
refactor was worked on while the bug was being fixed. there's no
problem with that, we've all done it. the problem comes when it's time
to commit the changes. if you use svn, you're screwed. svn only allows
you to commit files and not "hunks" of the file. in other words you
can commit myfile.cfm as a commit, but not lines 1-10 as one commit
and then lines 30-40 and 45-50 as another commit.
now with git i have total control over how i commit my code. if i want
to i can just do a "git add -i" and pick and pack away the commits how
ever i want. I don't like something i did, "git reset --soft HEAD~1"
and the recent commit is removed and the changes back to the staging
area. seriously, i'm not giving git enough credit in this feature
because it's really hard to explain the power behind this and you just
have to use it once to realize it. i would STRONGLY suggest you take 5
minutes and read the two posts on
gitready.com that cover this:
http://www.gitready.com/intermediate/2009/01/14/interactive-adding.html
http://gitready.com/advanced/2009/01/15/piecemeal-staging.html
the final reason and main reason why i made the switch to git, it's
decentralized, end of story. think of this for minute.... lay back and
close your eyes.... they're closed right? google code dies a horrible
death, the wheels repo is GONE. anyone have a backup of the entire
repo right now, anyone? of course you don't, because you've all
checked out trunk to your working copies. now it's not the biggest
deal because there really aren't a lot of branches in the repo and the
tags can get recreated. about the biggest loses would be the wiki and
the issues. but say we had 25 branches up there at various stages,
what would we do then? Even bigger problem, with the repo being gone,
how are you going to submit those changes that you've been working on
for the last 5 hours? You're not.
if github went into the toilet right now and was unavailable (which it
will be this Sunday when they move hosts), i could care less. since
every "git clone" basically pulls down the ENTIRE repo, i have all my
branches, tags right on my local machine. being that git is
decentralized, i can commit, branch, tag, rebase, merge all day. only
when i'm done doing what i want and want the rest of the world to see
my work do i "git push origin" and all of the work i've done gets
published. yes you read that right ONE COMMAND and all of the
branches, tags and changes i've done locally can get pushed to github,
ONE COMMAND. if i just want to push my master branch, i just do "git
push origin master".
so yeah this post was LOOOOONG winded, but like i said, i wanted to
post from the heart as to why even though i know right now there isn't
a comparable gui for git like there is for svn, it shouldn't stop us
from moving over to it if we want to. the benefits of using git FAR
out weigh the time it will take to learn the commands. it's going to
be painful, it was for me, but after using it for the past year i
can't and won't go back to using svn, cvs, vss or any other
centralized scm.
the only final reason i'll give to moving to git is because that's
what everyone is moving to! we all work on wheels because we love it
and want to build something fantastic, but let's face facts, we also
do it to prove, sharpen and learn new skills to become more marketable
when we need to look for a job. it's easier to show a client or a
potential employer open source code then closed source. so, imagine
losing a job or a contract to someone who had that one more skill that
you needed and that skill needed today is working with scms.