Skip to contentSkip to conversation

create easy to parse list of added / ,odified files

DISCUSSION Gelonida 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Gelonida

author
#0 lore raw

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

#1 lore raw

Hi,

Quoted 8 lines · Gelonida

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.

author
#2 lore raw

Hi Jonathan,

Quoted 11 lines · Jonathan Nieder
Quoted 8 lines · Gelonida

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.

Quoted 8 lines

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)