Questions tagged [githooks]
Git hooks are scripts that are executed upon certain Git events. Events include, but are not limited to, pre- and post-commit and pre- and post-rebase on the client-side, and post-receive-commit on the server-side. No need to use the tag Hooks when using the tag Githooks. Maybe used in combination with tag Webhooks
githooks
1,794
questions
-2
votes
0
answers
51
views
Where does git get the author information from
====== STR Start ======
git init test
cd test
touch test.txt
cd .git/hooks
mv prepare-commit-msg.sample prepare-commit-msg
nano prepare-commit-msg
Paste the following:
#!/bin/sh
echo "...
-1
votes
1
answer
43
views
git pre-commit hook does not open commit_template based on GIT_EDITOR value
I am developing a functionality for more automatic Git commits. We are using a pre-commit hook, and the idea of the hook is to request a task ID and summary, then write them to the commit template. We ...
-1
votes
1
answer
17
views
Slow git operation because of git LFS
The git operations in my local machine seem extremely slow because of git lfs. Operations like the git checkout branch or git commit take a long time.
time gco SAP-1205
Updating files: 100% (8288/8288)...
0
votes
0
answers
27
views
Git Gui Windows does not call pre-hook
I'm using Git git version 2.45.2.windows.1 and I implemented a prepare-commit-msg hook locally to my repository. Here is an MWE:
#!/bin/sh
# prepare-commit-msg hook
echo $0
filename=$(date | sed 's/[^...
0
votes
0
answers
23
views
Add an action to commit, to be executed post-pull - something like a one-time only git post-merge hook?
Is it possible to furnish a single commit with something akin to a pull-completion-handler?
Consider the situation:
I make some dramatic changes to some "meta-structures" in the repository. ...
0
votes
1
answer
28
views
pre-commit bash script not found even though it exists for .githooks [duplicate]
I'm really confused on this.
The file clearly exists and has executable mode on. this is not woking on my VM running fedora. but runs fine on windows host with git-bash
I did set -x to see but i see ...
1
vote
0
answers
27
views
pre-pull git-hook to run locally before pull
I'm experimenting with git-hooks and custom repo layout, where I need to prepare (update in a special way) sources before pulling changes from the remote.
I couldn't find the proper git-hook in the ...
1
vote
1
answer
30
views
git commit-msg hook trigger only on specific commit types
I created a .git/hooks/commmit-msg hook that is triggered correctly on git commit but on top of that, as other git actions such as
git pull
git merge
...
are also triggering the commit-msg hook.
Is ...
0
votes
0
answers
22
views
post-merge hook fails on git pull
I'm getting following error when post-merge hook is getting executed after git pull command:
husky - post-merge script failed (code 1)
Following is the script I'm trying to execute
#!/usr/bin/env sh
....
0
votes
0
answers
26
views
git hook is triggered but not executed [duplicate]
I created a post-receive hook like that
.git/hooks/post-receive
#!/bin/sh
set -x
touch file
and...
chmod +x .git/hooks/post-receive
when I push from the local repo I can see the debug message
...
0
votes
0
answers
26
views
Git hook for git worktree doesn't run "git submodule update --init --recursive" properly
I have a hook in git worktree that is run every time I add a new branch with git worktree add <branch>. (I use the post-checkout hook and make sure it only runs when HEAD is 0, i.e it's a ...
0
votes
0
answers
52
views
How do terminate input on git bash when scanning for user input?
I am trying to collect user input on a git hook and am doing so with the guidance from this post: How do I prompt the user from within a commit-msg hook?
I am following this approach using Golang of ...
4
votes
1
answer
5k
views
Husky add command is deprecated?
I'm trying to follow this tutorial on how to add a commit msg hook with Husky.
And this is the command given in the tutorial:
npx husky add .husky/commit-msg 'npx commitlint --edit $1'
However when ...
-1
votes
1
answer
92
views
A task from a Taskfile fails when ran from VScode
In my project, I have the following pre-commit hook:
#!/bin/sh
task validate_lint
In addition, in my Taskfile.yml I have the following:
validate_lint:
desc: Run black, flake8 and isort ...
0
votes
0
answers
57
views
Log a template message every time I commit in Git
I am making my own template that involves my a bit of custom git hooks. I opened the hooks folder, and everything was a .sample file which I know nothing about.
What I am doing is manipulating the ...