How do you deal with incomplete commits?

Nicolás Alvarez nicolas.alvarez at gmail.com
Mon Nov 2 18:08:53 GMT 2020


El lun., 2 de nov. de 2020 a la(s) 15:01, David Hurka
(david.hurka at mailbox.org) escribió:
>
> > I ended up writing a local pre-commit hook, which has the advantage of
> > triggering on the commit directly after "the problem commit", thus
> > increasing the likelihood there is still a trivial way to sort
> > things out.
>
> It would probably be nice to have some post-checkout commit, with which you
> can spit you own WIP commit message in your face, right after you switch to
> your work branch.
>
> There are update.sample and post-update.sample, but my git knowledge is
> missing in this point. What is “update”?

You want 'post-checkout' for this. The 'update' and 'post-update'
aren't useful here, they are for the server-side of git push (see the
'githooks' manpage).

> And now that we discovered that this is possible: I would like to have the
> pre-commit hook globally, that would fit my workflow nicely. How can I do
> that? My home directory is unfortunately not a git repository. ;)

You can use ~/.gitconfig to change core.hooksPath to a central
directory, but then per-repository hooks will no longer work (search
hooksPath in the 'git-config' manpage). That's a shame, I hoped there
would be a way to have both global and per-repo hooks...

-- 
Nicolás



More information about the kde-devel mailing list