githooks.com | simple guide to the wonders of Git Hooks | Awesome List library
kandi X-RAY | githooks.com Summary
kandi X-RAY | githooks.com Summary
A guide to the wonders of git hooks. This repo is using GitHub Pages.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of githooks.com
githooks.com Key Features
githooks.com Examples and Code Snippets
Community Discussions
Trending Discussions on githooks.com
QUESTION
Years ago, I used to work with a version control software that used to automatically add authors and the first line of the commit at the top of the source code. He found this very useful to quickly check the history without having to search through the commits. I'm wondering if this is possible with Git (right now, because of some external requirements, we at least need the authors of the file to be added into the file itself). I looked into git hooks but could not find anything so far in the post commit script. Our repositories are hosted on Bitbucket.
Since I have not been able to find anything so far, I'm wondering if this is even possible to be achieved and if so where can I start looking? Obviously if there is an open source script that does this, it would be the best.
Thanks for any pointers!
...ANSWER
Answered 2018-Aug-24 at 12:32There are a couple of problems in doing what you want to. If you want to modify a file during a commit you can do so in the pre-commit
hook. But at this particular moment your commit message does not exist, so you cannot add it to the file. You can only add author name, via a script that checks the first line against the config. Maybe another option is to reverse this, prepare the commit message based on the first line of the file, writing a prepare-commit-msg
or a commit-msg
hook.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install githooks.com
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page