Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3361888
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:12:25+00:00 2026-05-18T03:12:25+00:00

I am planning to write a few git hooks as a project which logs

  • 0

I am planning to write a few git hooks as a project which logs the user’s actions in a database. This database can then be used for querying for all his activities. The actions I am trying to log are

  • commit
  • pull
  • push
  • merge
  • branch

I want to get this packaged in distros which can be installed via package manager.
Git allows global hooks by placing any such in $PREFIX/share/templates/hooks

It currently has some hooks which are disabled (.sample is appended to their name). When a new repository is created, these hooks are copied in the .git folder of the repository

Now if a user installs the package for these hooks and hooks like post-commit and post-update are already enabled. In this case the script file will be overwritten! This sounds bad

This means git has only one hook file per action. If I need to keep three hooks for one action, it means it is not possible. This means automated install from package manager can introduce conflicts.

Now think that we packaged the hooks to overwrite the default enabled file. If a user wants to add some more actions to those file and then decided to uninstall my package, then his custom command would also be gone?

I thought that git was pretty clever in this regard and I was wrong 🙁

There needs to be a folder named post-commit and post-update or whatever actions and git should run all the scripts inside that folder. I am still hunting a way to deal with the current situation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T03:12:25+00:00Added an answer on May 18, 2026 at 3:12 am

    Why not write a post-commit hook (for instance) that will look for a “post-commit-hooks” subdirectory and will list and execute all scripts find in it?
    (the first one that doesn’t run successfully will fail the all post-commit hook)

    If the users initialize their Git repo from a predefined template directory, you can then make sure they all get those special scripts in their new repo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm planning to write a program in Ruby to analyse some data which has
I'm planning to write gateway web application, which would need terminal window with VT100/ANSI
I'm planning to write an operating system and I don't know very much about
Possible Duplicate: C++ HTML template framework, templatizing library, HTML generator library Planning to write
I'm planning on doing more coding from home but in order to do so,
We are planning on moving for MS Source Safe (ouch) to SVN. We are
I was planning to use url routing for a Web Forms application. But, after
I am planning to extend the basic html input tag provided by Spring to
I'm planning on creating a game that contains a landscape with objects on it.
I'm planning to propose to my (very small) company that we buy a computer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.