On Jan 1, 2008 1:05 AM, Jan Hudec <bulb@xxxxxx> wrote: > On Mon, Dec 31, 2007 at 21:26:21 +0800, Ping Yin wrote: > > On Dec 31, 2007 6:55 PM, Jan Hudec <bulb@xxxxxx> 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). > A little complicated-:). So my way is to abort the commit if pre-commit actually modified the files ( the working tree, not the index) to be commited, then 'git add -i' to add the changes introduced just by the pre-commit and 'git commit' again. -- Ping Yin - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html