10 reasons to upgrade your old Git installation
Git has seen a huge influx of newcomers over the past year. Many folks installed Git as they read through their first tutorial, got it working, and are still using that same trusty installation today. But rest assured, Git has not been standing still.
If you installed Git a year ago (perhaps when Rails made the move in April of last year), you would’ve grabbed v1.5.5. The Git team has cranked out five feature releases since then, full of usability improvements, a few new tricks, and, of course, numerous bug fixes. So it’s time for some spring cleaning of your dusty old Git installation.
If you’re not yet sportin’ the 1.6.3 hotness, here are ten reasons to Git up!
-
Everyone’s crazy-fast VCS is even faster:
git clone
andgit merge
have been rewritten in C. [1.5.6] [1.6.0] -
Viewing your staged changes no longer requires a cheatsheet in order to remember the command:
git diff --staged
serves as a substantially-more-obvious synonym togit diff --cached
. [1.6.1] -
Stashes always remember where they came from and make it easy to get back there:
git stash branch <branchname> [<stash>]
creates a new branch starting at the commit at which the stash was created, checks out the branch, and applies the stash. The stash is guaranteed to apply cleanly, no matter how much the rest of your fast-movin’ repo has changed. [1.6.0] -
If you mistype a command, Git offers a helping hand: Clippy says, “It looks like you’re trying to use SVN.” [1.6.1]
$ git stat git: 'stat' is not a git-command. See 'git --help'. Did you mean this? status
-
Branch navigation adopts basic filesystem navigation idioms: Use
git checkout -
to return to the last branch you were on. [1.6.2] -
A visualization of the ancestry tree is available without having to leave your terminal:
git log --graph
outputs hot ASCII graph pr0n in full technicolor. [1.5.6] [1.6.3] -
Getting a quick, lean log from the command line now requires less typing (and no forced compliments).
git log --oneline
replaces the need to use its older, more verbose cousin,git log --pretty=oneline --abbrev-commit
. [1.6.3] -
Speaking of things that are easier to type, reaching all the way over to hold down that cockamamie Shift key is hard work. Give yourself a break: If you’re on OS X, you no longer need to type “HEAD”; “head” works just the same. [1.5.6]UPDATE - As much as I enjoy that vacation from the Shift key, Junio Hamano was kind enough to get in touch to let me know that this case-insensitivity is unintended and “may even be considered a bug.” Allow me to present an alternate tip:Tidying up your list of remote branches is now possible with a single command:
git remote update --prune $remote
fetches updates for the named$remote
repository (e.g., “origin”) and prunes any stale tracking branches that you have lying around for that$remote
repo. [1.6.3] -
Searching for content no longer means scanning line after line to locate the matching text:
git grep
now highlights the matches in color. [1.6.3] -
The science of Branchology added a few handy new instruments: Use
git branch --no-merged
to list the branches that have not yet been merged into the current branch. Usegit branch --merged
to see just the opposite. [1.5.6]
And this is by no means an exhaustive list. An upgrade from v1.5.5 to v1.6.3 includes well over 100 improvements. While no one of these improvements is revolutionary, they each make this awesome VCS just a tad nicer. And collectively, they make it well worth the upgrade.
So what are you waiting for? Invest five minutes right now to upgrade. C’mon. You’re sittin’ around reading blogs. What else have you got to do? Git up!
–
Notes
If you’re on OS X, I recommend using MacPorts for quick and easy upgrades. Let Rob Sanheim show you the way.
Image courtesy of Midnight Digital (flickr.com/midnight-digital). [Creative Commons License]