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

Re: How to bypass the post-commit hook?

From
JHJan Hudec <bulb@ucw.cz>
Date
Dec 31, 2007, 17:05 UTC
Message-ID
<20071231170532.GB9214@efreet.light.src>
In-Reply-To
<46dff0320712310526l2b801ed7xc52b7aae2d65048e@mail.gmail.com>
On Mon, Dec 31, 2007 at 21:26:21 +0800, Ping Yin wrote:
Show 12 quoted lines
> On Dec 31, 2007 6:55 PM, Jan Hudec <bulb@ucw.cz> wrote:
> > Note, that you can -- and should -- add the foo.css to the commit. But the
> > file might contain other changes in tree, that are not about to be commited,
> > so prefered way would be to get the content from the index, modify that and
> > update the index manually (with git update-index).
> 
> If pre-commit has modified files to be commited, it will abort this
> commit and give a message to direct the user to commit again
> with/without the changed content.
> 
> AFAIK, git add -i can add selected chunk to the index. As you said,
> can git-update-index also do this job?
git update-index is the underlying plumbing for git add/git rm.

However, you should change foo.css in index even if the working tree copy does not match it and is not selected for commit. Only way I see to do that is to prepare a patch and apply it to both the working tree (git apply) and to the index (git apply --cached).

It will probably work for you without such finesse, you will just have to be aware of it's quirks.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Previous: Ping YinNext: Ping Yin
Message 8 of 9 in “How to bypass the post-commit hook?”
  1. Ping YinDec 30, 2007
  2. Jan HudecDec 30, 2007
  3. Pascal ObryDec 31, 2007
  4. Jan HudecJan 14, 2008
  5. Jan HudecDec 31, 2007
  6. Jan HudecDec 31, 2007
  7. Ping YinDec 31, 2007
  8. Jan HudecDec 31, 2007
  9. Ping YinDec 31, 2007

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.