threads / discuss / 24956

create easy to parse list of added / ,odified files

Subject: create easy to parse list of added / ,odified files

## tl;dr

3 messages between Sep 3, 2010 and Sep 5, 2010.

replies: 2people: 2as markdown or json

Gelonida· Sep 3, 2010, 06:36 UTC · lore
Hi,

for a pre-commit trigger I would like to retrieve the list of modified files, such, that I could analyze the contents prior to commit.

what would be the best command for this

I thought about using "git status", but wondered, which other command might return a nicer to parse list.

TIA
Jonathan Nieder· Sep 3, 2010, 06:39 UTC · re: Gelonida · lore

Re: create easy to parse list of added / ,odified files

Hi,
Gelonida wrote:
Show 8 quoted lines
> for a pre-commit trigger I would like to retrieve the list of modified
> files, such, that I could analyze the contents prior to commit.
> 
> what would be the best command for this
> 
> 
> I thought about using "git status", but wondered, which other command
> might return a nicer to parse list.

If you look at the git(1) man page, you will find a number of such "low-level (plumbing) interrogation commands" listed. For example:

 . git diff-index
 . git diff-files
 . git update-index
 . git status --porcelain
Hope that helps.
Gelonida· Sep 5, 2010, 21:50 UTC · re: Jonathan Nieder · lore

Re: create easy to parse list of added / ,odified files

Hi Jonathan,
On 09/03/2010 08:39 AM, Jonathan Nieder wrote:
Show 19 quoted lines
> Gelonida wrote:
> 
>> for a pre-commit trigger I would like to retrieve the list of modified
>> files, such, that I could analyze the contents prior to commit.
>>
>> what would be the best command for this
>>
>>
>> I thought about using "git status", but wondered, which other command
>> might return a nicer to parse list.
> 
> If you look at the git(1) man page, you will find a number of such
> "low-level (plumbing) interrogation commands" listed.  For example:
> 
>  . git diff-index
>  . git diff-files
>  . git update-index
>  . git status --porcelain
> 
Thanks for your answer.

I'm currently using git diff-index HEAD --cached

This seems to do what I was looking for.

git status --porcelain doesn't exist on my old cygwin git (I assume it's proably a little too old)

← back to recent threads