gitg, a prettier git UI

May 6th, 2009 by Dan

A while back I posted about a number of graphical interfaces to the git version control system. In the last couple of days I happened across a new system named gitg. Astute readers may have guessed that the second ‘g’ in the name stands for gnome and they would be correct.

Gitg has much the same feel as gitk does, but feels much more polished and is well worth a look. I find it quite handy to view the history of projects to get a visual representation as to what has happened in the history. It also has the ability to stage and commit changes.

Definitely check it out if this sounds like something you would find useful and you are using the gnome desktop environment.

Magento: my experiences thus far.

May 3rd, 2009 by Dan

If you have been looking around for an open source shopping cart / e-commerce system in recent times, you most likely have come across Magento at one point or another and wondered at how it works in real live.

There certainly are some good things to be said for it. It has an impressive feature set, and an intuitive interface which allows the store admins flexible control over discounts, pricing, taxes, etc. However there are some strong drawbacks to consider before taking the plunge and integrating it on a site.

Read the rest of this entry »

Configuring SSH

February 17th, 2009 by Dan

In the last while I have been having to connect to various servers using different accounts with different types of credential requirements. This has lead to some interesting ssh commands such as

ssh -l some_user -i ~/.ssh/other_key.pub example.com

After having a few servers and starting to lose the commands in my history, I figured there must be a better way to keep track of this. Turns out there is (surprise surprise). Inside your home directory, there’s a .ssh folder where you can drop a config file. So, to recreate the above example you would add the following section:

Host example.com
    User some_user
    IdentityFile ~/.sh/other_key.pub

and now I can connect with

ssh example.com

There is a whack of documentation about how this can make your life easier. Check out the man pages

man ssh_config

RAM – who knew it could take out a computer?

January 20th, 2009 by Dan

At one point or another I’m sure most of you have run across bad hardware. This past week I built a computer and was running into an odd situation. After about 2 minutes of running (or less) the system would completely lock up. Rebooting would sometimes make it to the login screen while other times it would just die part way through. Other times, the system wouldn’t event make it past the POST or show the BIOS loading screen.

Fearing a faulty motherboard, or inproper CPU installation, I decided to watch what was happening to the temperature in the BIOS. The temp was staying quite low ( < 30 C for both the CPU and motherboard) but, the system would still lock up… even in the BIOS screen. At this point I had detached everything except for the video card, 1 stick of RAM, and the hard drive and was still getting the same problem.

As a last ditch attempt, I swapped out the final stick of RAM for one of the other ones in the pile of components sitting beside the case. And what do you know, it worked!

Now, the only conclusion I can come to is that the RAM was overheating after about 2 minutes or so of use, and then completely ceasing to function. The bad memory addresses must have been quite close the beginning since even in the BIOS screen (where I’m assuming it doesn’t do all that much with RAM) would lock up.

Has any one else ever experienced something like this? For the record it was a Corsair 2GB stick.

git – commiting a portion of your changes

January 18th, 2009 by Dan

While code the other day I ran into a familiar situation where I wanted to commit just a few of my changes in a file instead of all of them. Some of the code was needed for a quick fix, but the rest was more in the building / testing phase. I know the better setup would have been to have a branch for the bigger change, and merge back when it was all ready to go, but unfortunately that wasn’t the setup this time.

Doing a bit of researching, I found that using git it is possible to commit some of your changes instead of all of them. To do this I have found the interactive commit command the most straight forward to use.

To begin an interactive commit,  issue the command with the –interactive flag (note, that’s two dashes, not the one long one)

git commit --interactive
           staged     unstaged path
  1:    unchanged        +3/-0 index.php
 
*** Commands ***
  1: [s]tatus	  2: [u]pdate	  3: [r]evert	  4: [a]dd untracked
  5: [p]atch	  6: [d]iff	  7: [q]uit	  8: [h]elp
What now

As you can see it gives you a number of options. In this case we want to patch the file so we hit ‘5’ and then hit enter.

What now 5
           staged     unstaged path
  1:    unchanged        +3/-0 [i]ndex.php
Patch update

This is showing us a list of files that we can choose to patch from. Hitting 1 will select index.php for patching. You have to hit return again to begin the process after a file has been selected.

Patch update 1
           staged     unstaged path
* 1:    unchanged        +3/-0 [i]ndex.php
Patch update
diff --git a/index.php b/index.php
index 90ea18f..e2f84ef 100644
--- a/index.php
+++ b/index.php
@@ -1,7 +1,10 @@
 this is a test of how to commit partial files
+this is the first addition to the file
 some more changes
+and another line goes here
 testing
 and some more testing here... this is fun!
 
 adding some content to the bottom of the file
+okay, last one for now
 and a couple more
 
Stage this hunk [y/n/a/d/s/?]?

Hitting ‘s’ will split the current hunk and show you the changes to the file one hunk at a time giving you the option to stage the change or not.

After you are satisfied with how you have things set up, hit 7 to quit when given the option and git will bring you to the familiar comment adding screen.

Doing a git diff right after doing this will show you that only the staged changes got committed, the rest are still waiting there for whenever you’re ready to commit them as well.