I have a post-checkout
hook that I use locally in all of my repos (it renames my tmux session to repo-name/branch-name
)
For a project I am working on, we just added a post-checkout
hook that we're asking the whole team to use.
I don't want to add my personal hook's logic to the team-wide hook, because it's not useful to everyone, but I also don't want to give it up.
Is there a way to have more than one script execute on a single git-hook trigger? I want every git checkout
to execute the teamwide post-checkout
hook and execute my personal post-checkout
hook. I can't have two files named the same thing -- is there a way to get around that?
Update: A good approach is, "make post-checkout
call the two other scripts. I like this idea, and it may be the solution.
However, right now we have an automated setup step that copies post-checkout
into the hooks directory. If possible, I'd like to do this in a way that doesn't interfere with the existing team setup, and doesn't require manual tweaking on my part if I run that install step again later.
If that's not possible, that's cool, but I'm curious about even more creative solutions.
post-checkout
that calls them both?post-checkout
into thehooks
folder, that's the file that Git is going to use for that hook; there is little you can do about that. I'm afraid some manual tweaking on your part is required, here. After all,post-checkout
is a client-side hook. If your team wants to enforce some policy, they should leave client-side hooks alone (they're your business, not your team's) and use server-side ones instead.