Re: How to bypass the post-commit hook?
- From
Ping Yin <pkufranky@gmail.com>
- Date
- Dec 31, 2007, 13:26 UTC
- Message-ID
- <46dff0320712310526l2b801ed7xc52b7aae2d65048e@mail.gmail.com>
- In-Reply-To
- <20071231105514.GA9214@efreet.light.src>
On Dec 31, 2007 6:55 PM, Jan Hudec <bulb@ucw.cz> wrote:
Show 13 quoted lines
> On Mon, Dec 31, 2007 at 18:22:37 +0800, Ping Yin wrote: > > On Dec 31, 2007 5:31 PM, Jan Hudec <bulb@ucw.cz> wrote: > > > On Mon, Dec 31, 2007 at 13:08:05 +0800, Ping Yin wrote: > > > Note, that while you don't know the commit sha1 before the commit, you do > > > know the *blob* sha1s. So you can do this change in pre-commit hook. > > > > I chose post-commit because i used commit sha1 instead of blob sha1 as > > file version in the first time, and now pre-commit seems better. One > > more question, I use 'git ls-files' to fetch the blob sha1, so is the > > got sha1 the same when pre-commit and post-commit? > > Yes, it should be. >
Good news. So pre-commit is actually the right choice.
Show 5 quoted lines
> > 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?
-- Ping Yin