git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ping Yin" <pkufranky@gmail.com>
To: "Jan Hudec" <bulb@ucw.cz>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: How to bypass the post-commit hook?
Date: Tue, 1 Jan 2008 01:53:48 +0800	[thread overview]
Message-ID: <46dff0320712310953x13668223iafed07f7d912e6f3@mail.gmail.com> (raw)
In-Reply-To: <20071231170532.GB9214@efreet.light.src>

On Jan 1, 2008 1:05 AM, Jan Hudec <bulb@ucw.cz> wrote:
> On Mon, Dec 31, 2007 at 21:26:21 +0800, Ping Yin wrote:
> > 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).
>
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

  reply	other threads:[~2007-12-31 17:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-30 15:12 How to bypass the post-commit hook? Ping Yin
2007-12-30 21:50 ` Jan Hudec
     [not found]   ` <46dff0320712302108i61f3b868obb93f89c1c24062c@mail.gmail.com>
2007-12-31  9:31     ` Jan Hudec
     [not found]       ` <46dff0320712310222m64d86e95l1499a7ffb1fff65c@mail.gmail.com>
2007-12-31 10:55         ` Jan Hudec
2007-12-31 13:26           ` Ping Yin
2007-12-31 17:05             ` Jan Hudec
2007-12-31 17:53               ` Ping Yin [this message]
2007-12-31  9:50   ` Pascal Obry
2008-01-14 17:59     ` Jan Hudec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46dff0320712310953x13668223iafed07f7d912e6f3@mail.gmail.com \
    --to=pkufranky@gmail.com \
    --cc=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).