Color Coding in Git


I recently started reading Pragmatic Version Control Using Git.  Some of the early stuff will be review, but I don’t have a solid foundation in the server-side aspects of Ruby on Rails, so I’m working on it.  In the first chapter, I stumbled on a real gem: Git can be configured to spit out the familiar red-green color coding that we all know and love in autotest and other red-green-refactor testing.  (You are using Test Driven Development, right? )

Enter this at a command prompt:

git config --global color.ui "auto"

That makes your git output (after making changes) look like this:

mysite$ git status
# On branch master
# Changed but not updated:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#	modified:   index.html
#
no changes added to commit (use "git add" and/or "git commit -a")
mysite$ git add index.html
mysite$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#	modified:   index.html
#

If this doesn’t seem like much, it’ll get much more important when you’re looking at a long list of files in different states.

About these ads

Tags: , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: