#!/bin/sh # git-s -- selection-friendly git-status git status -s | perl -ne ' push @{$x{$1}}, $2 if /^(.). (.*)/; push @{$y{$1}}, $2 if /^.(.) (.*)/; END { delete $x{"?"}; for ([">" => \%x], ["." => \%y]) { ($n, $h) = @$_; for (sort keys %$h) { next if $_ eq " "; print "$n$_"; print " $_" for @{$h->{$_}}; print "\n"; } } } '