From: Junio C Hamano Date: Sat, 22 Sep 2007 00:15:26 GMT Subject: Re: [PATCH] post-checkout hook, and related docs and tests Message-ID: <7vzlzfh7xd.fsf@gitster.siamese.dyndns.org> In-Reply-To: <1190406421-15620-1-git-send-email-jjengla@sandia.gov> "root" writes: > +post-checkout > +----------- > + > +This hook is invoked when a `git-checkout` is run on a local repository. > +The hook is given two parameters: the ref of the previous HEAD, and the ref of > +the new HEAD. This hook cannot affect the outcome of `git-checkout`. > + > +This hook can be used to perform repository validity checks, auto-display > +differences from the previous HEAD, or set working dir metadata properties. > + People may wonder why this is not run when they do "git checkout otherbranch path.c"; the second sentence from the above description implies why it shouldn't, but the first sentence probably should state it more clearly. What's the _semantics_ you are trying to achieve? Why does the hook run every time git-bisect suggests the next revision to try? Why does the hook run when rebase starts its work? When "git pull" or "git merge" results in a fast forward, the situation is no different from checking out a new revision. Why doesn't the hook run in these cases?