Monthly Archives: November 2009

Git Over It

git-logo

Git is a tool used extensively for open source projects.  It is a way of distributing source control instead of the typical central repository.  History has it that Linus Torvalds himself developed the original tool.

Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.

Why is it called git?  The theory is that Linus named it after himself. :)  However, no one seems to know for sure.

Why git?  It all started as a dispute between the Linux developers and BitKeeper.  The BitKeeper tools had been free to the community until the company charged the developers with reverse engineering their product.   The result was that developers would need to pay to continue using BitKeeper.  Given the “free” nature of Linux development this obviously did not go down well.  Linus led the project to develop an alternative and the result is git.

The overall good news is that git has been widely adopted even though it was only created starting in 2005.  There are several good features it has compared to the traditional source control solutions.

  • Offline changes
  • Free (always helps)
  • Fairly simple commands
  • Distributed source management
  • Open source (for the hardcore)

To get a better introduction, visit the git homepage.  As a set of examples of this homepage:

Git Is...There is also a section on quick start.  Git has two paths for creating a repository.  Either it is created from a clone from another server or it is created from scratch.

GitQuickStartAnything in parentheses is meant to be replaced with specific actions (like a directory or file).  To keep it simple, it is best to experiment with a locally created depot.  It is worth doing an easy walk through of the creation.

  1. git init
  2. git add .
  3. git commit -m “My message”

“git init” creates the initial depot for this current project.  It creates a subdirectory (usually hidden) called .git which contains all the information that git needs to keep to manage the source.  Think of it as being where everything is kept to keep git happy.

“git add .” instructs git to find every single file under the current directory and add it to the staging area to be prepared for committing. It will only add files that are new or changed when used with the “.” which is a great trick.  If there are files that you do not want to automatically add, you can always change the “.gitignore” file to skip over them.  Typically the object and binaries need to be skipped if the tree is actually built.  Doing the add is really just a sign of intent.  It does not actually change anything in the git tree.  Also of note, if you change any files that have been added, you need to add them again if you want to capture the changes in the staging area.

There is nothing to fear with commitment.  Commit with “git commit” just means that you want to capture all the changes into one thing.  This is where it updates the local git tree and it is seen as a kind of “snapshot” of where the code is at.  Keep in mind that a commit means nothing to anyone else.  A commit is just a local thing.  This enables git to be used offline and without the need for a central server ever.

However, git can also be used in a distributed team.  In fact, that was the original intent.  That is the point of the other path for creating a depot on the local machine.

Working off of a remote depot is in this order:

  1. clone a remote depot (git clone)
  2. make changes to the local files (git add)
  3. commit the changes (git commit)
  4. send the patch to someone that cares (git format-patch)

This is not the only way to do it.  It is also possible to submit the changes back to the remote depot assuming you have been authorized.

Coming from a world of PVCS and Perforce, git can take some getting used to.  It seems uncommon for git to be used in commercial products in Citrix (except for Xen products).  XenApp and XenDesktop are based on Perforce.

There are so many different places you can go to find out more about git.  Here are some examples:

Linus Torvalds (git creator) speaks about git at Google Talks.

Thanks goes to Michael Wookey in Citrix Labs Sydney for being such a great git advocate.

Linux Bridge

Having come from a Windows background, it can be very interesting to try catching up to where the Linux world is now.  It is more than likely that most Linux people feel the same way about Windows.  Well, more accurately they usually despise Windows and would rather leave that to someone else.  Generalities, of course, are not that accurate. sydney-harbour-bridge-nightThere have been many different paths to bring the two worlds together.  Most of this due to work done by open source projects.  Microsoft has semi-embraced working with Linux.  Typically Microsoft likes to position competitors into specific boxes.  Even though Linux is hard to contain, Microsoft likes to paint it as having no common thread for all the different distributions.  It also tends to show it as not being enterprise quality.

The ironic thing is that Microsoft has been heavily influenced by Unix and Linux over the years.  Many of its biggest core offerings are derived from ideas created by common research years ago.  No one company can really go it alone but it is possible to pretend that you thought of everything yourself.

Regardless of how Microsoft handles this today, the truth is that battle with Linux has been going on for many many years.  It appears that they have toned down the opposition for fear of offending key large accounts (typically governments).

So, what is the point of this blog post?  Really, it is just a place to sum up ways of using Linux tools in Windows. Unknown to most Windows users, there are Windows version of Linux tools.  Also, some of these tools are quite useful. As part of my current project, it has become very important to develop for Linux.  This is a blog post in itself.  All I intend to do here is list the more interesting tools.

wget – get a file from the Internet from the command prompt (either HTTP, HTTPS,  or FTP)

winscp – copy files between Windows and Linux

msysgit – source control (git for Windows)

cygwin – Linux shell on Windows

7zip – compression of just about every model

Instead of writing a huge list, it is better to focus on just these.  The current star is wget.  I am using it to download a 6GB file over the net.  Using standard browser download is unfriendly since it tends to get errors and does not having decent handling of retry.  Wget is expert in trying the download again and at the point that it left off.  In general, wget makes it easy to automate downloading just about anything.  Not only that, it is quite simple to start with.

7zip is attractive because it can do so much for so little.  It can register itself for a very long list of compression types.  Not only that, it is quick and easy.  Being able to browse an ISO without having to dig up a special program is so nice.

WinSCP is great for making copying easier between different systems.  Drag and drop of entire directories is just a click away.  It is stable and fairly fast.  Yesterday I used it to copy a 10GB file between Windows and a Linux server.  When I was done processing the file, I used it to copy back.  Now that is a great simplification of the process.

To me, the tools are better when compiled for Windows instead of running inside cygwin.  The authors have expanded the tools in some ways.  The best kind of expansion comes from using the Windows UI to drive it.

GIT is a tool to manage source and is very common for Linux-based projects.  Using git on Windows is possible thanks to a port that is available from Google code.  There is also an extension that more deeply integrates with Visual Studio.  The UI version is easier and more powerful (to the beginner) than the command line.  Learning the command line options and flows can be quite time consuming and frankly can be a waste of time for the average developer.

At some point, a future post will be about writing code for both Windows and Linux.  This has been my focus over the last year related to supporting VHDs in XenClient.

Blog Evaluation

BlogStats

This blog has been going for three years with this being the 301st post.  Within the last year, things have slowed down considerably for a number of different factors.  Perhaps the biggest reason is being too busy with the current project (XenClient).  However, there are several other factors as well.

Blogging turns out to be a mostly solitary venture.  It takes a great deal of commitment and time to formulate a blog that gathers widespread adoption.  Even then, I suspect that success breeds pressure to always push harder.  It is difficult to gain that kind of momentum and keep it there.  This kind of stress is similar to anyone trying to hold on to success and fame.  Very few go the distance.  Perhaps very few should.

Originally I had big plans for doing this.  It seemed like a great idea for bringing in new customer requirements.  It also seemed like a good place to try out some ideas of my own.  Quietly, I hoped for a large following.  I tracked the visits per day and experimented with different blog postings to see what would make a difference.  This theory was flawed.  Any particular post might do better than others but overall it really did not make a big difference.

At one point the goal was to have about a hundred visits a day.  There was a blog post almost every day.  This artificially seemed to push up the numbers based on the number of posts but never seemed to bring any kind of long term growth.  It was probably similar to typical sales cycles.  The sales guy can always make things look better based on activity at the end of the month but the same person will never guarantee long term great results.

Later on, it just seemed a bit pointless.  The things I had set out to do just did not happen.  Also, ironically, my visit rate jumped up consistently with complete blog neglect.

It seems a bit like tracking the stock market.  The sooner it is realized that logic has nothing to do with it, the better.

Which brings us back to passion and purpose.  Success is truly an internal event.  It is the belief that one has a passion for doing something that really brings about the best results.  In fact, it is also the belief in letting go and being able to admit to mistakes which clears the way to a better future.

My passion is mostly about making things better.  I enjoy learning how things work (in true engineering fashion) and proceeding to think of ways of making it work even better.  Everything can be improved.  That alone is a major passion of the entire business world.  Some people focus on how much they can get.  Others do it for the thrill of making a difference.

So, what the heck does all this mean?  Well, either it means nothing or it means that I might have finally found new purpose to doing this blog.  I suspect it is the latter.  Time will tell.

For some, this might be seen as some kind of “middle-aged” blog crisis.  Perhaps it is.  At this point I do not even really care. :)

It is perhaps when I am most concerned about what people think that I am the most evasive.

To clear the air and breath fresh, is actually quite good.  Shadows of the mind dance more harsh than the path of the real daylight.  In other words, the thoughts overshadow action.  In fact, thoughts can easily confuse what path to choose.

With that in mind, it is time to start over.  The blog needs renewing and obviously refocus as well.