Sunday, June 22, 2008

Interacting with GIT

Git interactive rocks!

It's a quick and easy way to stage several files [for a subsequent commit], regardless of location and name, without an IDE or ninja master scripting skills . . .example follows: [my typing in bold]

machine1$ git add -i
staged unstaged path
1: unchanged +7/-2 Classes/AllViewController.m
2: unchanged +2/-0 Classes/AppDelegate.h

*** Commands ***
1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
What now> 4

1: Classes/FilteredByGroupViewController.h
2: Classes/FilteredByGroupViewController.m
3: Classes/GroupsViewController.h
4: Classes/GroupsViewController.m
Add untracked>> 1-4
* 1: Classes/FilteredByGroupViewController.h
* 2: Classes/FilteredByGroupViewController.m
* 3: Classes/GroupsViewController.h
* 4: Classes/GroupsViewController.m
Add untracked>> [enter]
added 4 paths

*** Commands ***
1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
What now> q
Bye.

machine1$


update (July 1): just for comparison, a co-worker sent me one of those wonderful scripting commands for subversion to add all unknown files:

svn stat -u | awk '/^[?]/ { print $NF }' | xargs svn add


No comments: