Skip to contentSkip to conversation

How to `git status' without scrambling modified with new, etc

DISCUSSION Harry Putnam 3 participants 4 messages May 5, 2017 – May 9, 2017

lore
Share & tools
lore
#0 lore raw

This is probably what everyone sees:

When I run `git status'; I see modified and newfiles scrambled together

Is there a trick or technique to make that output show each category separately?

Or do folks just a throw a `sort' in there (git status|sort) and lose the color ouput?

#1 lore raw
Quoted 9 lines · Harry Putnam

This is probably what everyone sees:

When I run `git status'; I see modified and newfiles scrambled together

Is there a trick or technique to make that output show each category separately?

Or do folks just a throw a `sort' in there (git status|sort) and lose the color ouput?

If you set color.ui=auto it'll disable coloring when it detects that the output isn't to a terminal, i.e. being piped.

It sounds like you want:

    git -c color.ui=always status --short|sort

But there's no native option to sort the status output, but that'll do it for you.

#2 lore raw
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Quoted 6 lines · Harry Putnam

This is probably what everyone sees:

When I run `git status'; I see modified and newfiles scrambled together

Is there a trick or technique to make that output show each category separately?

You can use git status -s and match on the modification type (M corresponds to modified, A to new files). See the man page for more details on the interface.

Quoted 12 lines
Quoted 2 lines

Or do folks just a throw a `sort' in there (git status|sort) and lose the color ouput?

If you set color.ui=auto it'll disable coloring when it detects that the output isn't to a terminal, i.e. being piped.

It sounds like you want:

    git -c color.ui=always status --short|sort

But there's no native option to sort the status output, but that'll do it for you.

#3 lore raw
Quoted 3 lines · Samuel Lijin

You can use git status -s and match on the modification type (M corresponds to modified, A to new files). See the man page for more details on the interface.

ahh yes. Just the ticket thanks