git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: simple example for git hooks

From
KFKnut Franke <k.franke@science-computing.de>
Date
Sep 3, 2010, 09:43 UTC
Message-ID
<201009031143.10539.k.franke@science-computing.de>
In-Reply-To
<i5p9vl$tk$1@dough.gmane.org>
On Friday 03 September 2010 00:54:44 Gelonida wrote:
Show 7 quoted lines
> ok, so it seems what I'm missing is THE command to list all added /
> modified files
> I could of course use
> 
> git status
> 
> and parse its output, but this is probably not the right way to do.

Not unless you use the --porcelain option, which is explicitly meant to produce parsable output.

For instance, if "a" has staged modifications, "b" has unstaged modifications and "c" is added (and staged), you'll get

$ git status --porcelain    
M  a                                           
 M b                                           
A  c

i.e. the first character in a line denotes the difference between HEAD and index and the second character denotes the difference between index and working copy.

-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 
Previous: GelonidaNext: Neal Kreitzinger
Message 4 of 6 in “simple example for git hooks”
  1. GelonidaSep 2, 2010
  2. Ævar Arnfjörð BjarmasonSep 2, 2010
  3. GelonidaSep 2, 2010
  4. Knut FrankeSep 3, 2010
  5. Neal KreitzingerSep 3, 2010
  6. GelonidaSep 5, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.