git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature idea: Git hook for pre-checkout
@ 2025-01-29 10:49 Mike Weltevrede
  2025-01-30  2:18 ` brian m. carlson
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Weltevrede @ 2025-01-29 10:49 UTC (permalink / raw)
  To: git

Good morning,

I had an idea for a feature in Git. I am not sure if this is the
correct channel, but I could not find anything else. If not, could you
please let me know the best way to submit this?

Below, I will explain the idea and then the problem that this would solve.

<The idea>
I have a project that is using Git hooks. Besides pre-commit and
pre-push, I would like to use pre-checkout (rather than the already
available post-checkout). However, it seems like an active choice not
to have pre-checkout given the existing hooks, so I am curious as to
the reason behind this.

<The problem>
I want to do branch name validation when someone does git checkout -b.
If the branch name does not meet the requirements, the user should not
be allowed to checkout to it. As such, the post-checkout hook does not
fully meet my needs. It helps with doing the branch name validation,
but if it fails, the user is still on the feature branch. As such, if
they are ignorant about the error message, this does not stop them. I
am currently combining post-checkout and pre-push but would prefer
pre-checkout because this would prevent the user from doing work on
this feature branch and having to move their work.


I am looking forward to your thoughts. Thank you for your consideration.


Met vriendelijke groet / Kind regards,

Mike Weltevrede

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-01 10:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-29 10:49 Feature idea: Git hook for pre-checkout Mike Weltevrede
2025-01-30  2:18 ` brian m. carlson
2025-01-30 14:11   ` Konstantin Khomoutov
2025-01-30 17:25   ` Junio C Hamano
2025-02-01 10:09     ` Mike Weltevrede

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).