Is there either an existing command, or some trick or script that allows me to show the status of the files shown in “ls”?
Something like the following:
$ git ls status #Command could be anything `lsg` is fine too, whatever.
app contents modified
autotest up-to-date
config up-to-date
config.ru staged
db contents modified
doc contents modified
Gemfile modified
Gemfile.lock modified
lib up-to-date
log up-to-date
public up-to-date
Rakefile up-to-date
README up-to-date
script up-to-date
spec up-to-date
tmp up-to-date
vendor contents modidified
test.tmp removed
In any way: having the git status information available in a directory listing.
Using the Git status short format information, here’s a Bash script that uses Awk and the
columncommand to give you customized status output.If you create an executable
git-status-lsin a directory on yourPATH($HOME/binshould be a good place), you can typegit status-lsin any Git repo. Or you could create a Git alias one-liner for this. You could also implement this using Perl, Python, C or whatever language you’re most comfortable with.Here’s a sample output:
Just realized, tabs are displaying as spaces. In the Awk script
print f " " stat;and in thecolumn -t -s " "command, there is a tab (not spaces) between the double-quotes. You could use a separator other than tab.Noticed an issue with the status flags handling in the above script and corrected it.