Fun with Decentralised Version Control
One thing Windows does better than Ubuntu on my Alienware M17x is allow
me to use the low power mode on the laptop, which is perfect when
flying.
Once I had set up a simple development environment on my
Windows partition, I needed a way to be able to work on my Coldfusion
code, but not lose any of my source control history. This is where the
power of Git became so very useful.
Since
each Git local repository is a full Git repository in it's own right,
and any Git repository can pull from any Git repository, I did the
following:
While in Ubuntu, plugged in my USB key stick
- Opened up a terminal at my usb stick
- Cloned my local git repository to the USB Stick
git clone /home/mark/wwwroot/coldspring ./ - Rebooted into Windows
- Opened a Cygwin terminal (Yeah, I use Cygwin in Windows, as I hate the Windows terminal)
- Cloned the repository on my USB stick to my C: drive
git clone /cygdrive/g/coldspring ./
Once I had got off the plane, and got back to doing work on my Ubuntu partition again, I needed to move the commits in the repository in my Windows partition back to my Ubuntu partition.
This is now very easy, again, due to the distributed nature of Git, and the fact that any repository can pull from any repository. To return all my commit history to my Ubuntu partition, where I do my main development, I did the following:
- Log into my Windows partition
- Go to the repository on my flash drive, and pull from the Git repository on my windows hard drive.
git pull /cygdrive/c/wwwroot/coldspring - Boot back into my Ubuntu partition
- Open a terminal in my source folder for Coldspring 2, and pull from the Git repository on my Flash Drive (/media/corsair).
git pull /media/corsair - Voila - my commit history is intact, and all the changes I made on my Windows partition are on my Ubuntu partition.






Comments
Posted by Luis Majano on 08 September 2010 06:59 AM
Yes I have to agree with you Mark, I am loving git, it has its quirks and differences and coming from a full SVN background I am still adjusting, but I can honestly say the best way is to just throw yourself into the fire and learn something new! Don't be afraid of change.
Posted by Andrew Scott on 17 September 2010 11:12 PM
Having been in the world of Eclispe and SVN, i still don;t see the power of GIT?
If you want a local repsoitory, then ask eclispe to collect the changes for as many days you want.
Unless I am missing something, the final merging of code is in GIT is still just as painfull as if you were doing it in SVN.
Posted by Mark on 18 September 2010 09:48 AM
@Andrew - I think you haven't seen the light because you haven't tried it yet ;o) There are so many advantages over SVN it's a longer list than I can write in a comment.
If you are tracking changes locally... how do you branch with Eclipse history? Or merge that branch? How do you stash local changes so you can switch out to do other work? How do you get at the work of another developer sitting next to you without having to go through creating SVN branches on your remote repository... the list goes on and on.
Posted by Andrew Scott on 18 September 2010 10:01 AM
Mark, you might be right. I haven't given it a chance.
However, I was very largely put of by the fact that for me to run GIT I am forced to install a 3rd pary application called cygwin, just because the developers have strong hooks into *nix API.
That is enough for me to say nope not yet.
As far as all those benefits, yes I can see advantages to them. But I have no problems switching code bases when I need to work on a branch or trunk in SVN now. The downside to SVN is that I may loose any changes not in SVN, which I think is a benefit to GIT.
but how many people actually work in this way to begin with, to many people still don't even use SVN to its full advantages either.
Posted by Bob Chesley on 30 September 2010 10:19 PM
I liked Luis's comment about jumping into the fire! I recently switched from SVN also and liking git very much. Just found Scott Chacon's concise comparison at http://whygitisbetterthanx.com in defense of git (nicely done).