Matthew Todd

git out

I’ve been using a new git alias lately, and it’s been useful enough I thought it would be good to share:

[alias]
    out = !git log --boundary $(git rev-list --max-count=1 --simplify-by-decoration HEAD^)..

The basic idea behind `git out` is to show your current “outstanding” commits, whether they be on a topic branch or unpushed back to your most recent remote.

So, in my shoe project, `git out` on the master branch currently shows I have 4 unpushed commits:

(ruby-1.8.7-p249@shoe) ~/Code/shoe (master) git out
25e7118 (HEAD, master) Add --webcvs to rdoc_options. 33 minutes ago
9c58b84 Note the shoe executable could use resiliency. 2 hours ago
105fe2d Clean up cucumber task. 2 hours ago
e37b0d5 Explain commented-out calls in generated gemspec. 2 hours ago
3faf5ec (v0.5.1, origin/master) Release 0.5.1 20 hours ago
(ruby-1.8.7-p249@shoe) ~/Code/shoe (master)

And `git out` on the man topic branch shows one unmerged commit:

(ruby-1.8.7-p249@shoe) ~/Code/shoe (man) git out
f25dd3e (HEAD, man) Start experimenting with ronn in the Rakefile. 61 seconds ago
25e7118 (master) Add --webcvs to rdoc_options. 49 minutes ago
(ruby-1.8.7-p249@shoe) ~/Code/shoe (man)

And that’s about it. I’d love to know if you end up using this, since things can get awful lonely over here sometimes. :-) Also, thanks to Joe Ferris for the fun name!

Comments