threads / discuss / 45876

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

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

## tl;dr

4 messages between May 5, 2017 and May 9, 2017.

replies: 3people: 3as markdown or json

Harry Putnam· May 5, 2017, 14:02 UTC · lore
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?

Ævar Arnfjörð Bjarmason· May 5, 2017, 14:24 UTC · re: Harry Putnam · lore

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

On Fri, May 5, 2017 at 4:02 PM, Harry Putnam <reader@newsguy.com> wrote:
Show 9 quoted lines
> 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.

Samuel Lijin· May 5, 2017, 21:06 UTC · re: Ævar Arnfjörð Bjarmason · lore

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

On Fri, May 5, 2017 at 9:24 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 7 quoted lines
> On Fri, May 5, 2017 at 4:02 PM, Harry Putnam <reader@newsguy.com> wrote:
>> 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.

Show 12 quoted 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.
Harry Putnam· May 9, 2017, 19:42 UTC · re: Samuel Lijin · lore

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

Samuel Lijin <sxlijin@gmail.com> writes:
> 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

← back to recent threads