better git status
Posted by jacqui maher on March 07, 2008 at 05:01 PM
My typical morning usually goes like this:
- put the laptop on desk & turn it on
- get coffee :)
- open adium/textmate/firefox/terminal/etc.
- type: git status in my project’s RAILS_ROOT
- try to recall what I did in those local modifications, and then either copied and pasted (ugh I hate having to use the mouse!) the paths for each file, or tab-completed each file path, to open it in Textmate… or opened the project, cmd-T, searching for each.
The thought had occured to me several times that there must be a better way.
This is what I came up with, and so far, it works for me.
1 tinsel:bin jm$ ./gitstatus -h
2 Usage: gitstatus [options] [paths ...]
3
4 Specific Options:
5 -d, --diff Show git diff output for each locally modified file.
6 -t, --textmate Open each locally modified file in Textmate.
7 -h, --help Show this message
Example:
1 tinsel:workspace jm$ ~/bin/gitstatus -d
2 [MODIFIED]: app/controllers/listings_controller.rb, app/models/listing_criteria.rb, config/environment.rb, plugins/criteria/lib/criteria/criteria.rb
3 [DELETED]: spec/rcov.opts
4 [UNTRACKED]: script/import/nnj/njtransit.rb, spec/fixtures/nyc_data_pad_addresses.yml, spec/fixtures/nyc_data_pad_buildings.yml, spec/fixtures/nyc_data_street_names.yml
5
6 ************app/controllers/listings_controller.rb************
7 diff --git a/app/controllers/listings_controller.rb b/app/controllers/listings_controller.rb
8 index 74a0e6c..4d11c1e 100644
9 --- a/app/controllers/listings_controller.rb
10 +++ b/app/controllers/listings_controller.rb
11 @@ -141,10 +141,10 @@ class ListingsController < ApplicationController
12
13 def search
14 -
15 +debugger
16 - if(@criteria[:area] && @criteria[:area].index(",") == nil)
17 + if(@criteria[:area] && @criteria[:area].index(",") == nil)
18
19
20 open in textmate? [Yn] _
If you want it, go ahead and grab it: gitstatus.rb