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 mergehave 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 --stagedserves as a substantially-more-obvious synonym to
git 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]
- Getting a quick, lean log from the command line now requires less typing (and no forced compliments).
git log --onelinereplaces 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, apparently it is unintended behavior and “may even be considered a bug.” (Thanks to Junio Hamano for providing the inside scoop.) Allow me to present an alternate: Tidying up your list of remote branches is now possible with a single command:
git remote update --prune $remotefetches updates for the named
$remoterepository (e.g., “origin”) and prunes any stale tracking branches that you have lying around for that
Searching for content no longer means scanning line after line to locate the matching text:
git grepnow highlights the matches in color. [1.6.3]
- The science of Branchology added a few handy new instruments: Use
git branch --no-mergedto list the branches that have not yet been merged into the current branch. Use
git branch --mergedto 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!
If you’re on OS X, I recommend using MacPorts for quick and easy upgrades. Let Rob Sanheim show you the way.