1,799
questions
0
votes
2
answers
32
views
Git-hook to show if I've got a stash on the checked out branch
The following has happened a couple of time and I'm looking for an automated way to catch myself before I repeat the mistake. Solutions saying "just remember" or "just don't do that&...
0
votes
0
answers
22
views
Git post-receive hook to auto-merge has unexpected behaviour. Prints all files and leaves uncommited changes
I have two separate repos with these branches.
dev-repo
main -> prod-repo/main
dev
prod-repo
main
production
Prod-repo is always on branch "production" and is the running code of the ...
-2
votes
0
answers
41
views
ESLint 8.57.0 - Error with Git Hooks - Could not serialize parser object (missing 'meta' object)
So I've upgraded to ESLint version 8.57.0. The linting works in terminal when running by it self however I get the below error when I run a git commit (Git Hooks with Husky).
The Error
✖ eslint --...
0
votes
1
answer
43
views
How to solve 'setter for fileMode: Int?' is deprecated. Deprecated in Java in build.gradle
I register a new gradle task in my build.gradle.kts to install git hooks every time I build.
tasks {
register("installLocalPostCommitGitHook", Copy::class) {
from(File(...
-1
votes
0
answers
63
views
Append to commit message via Git hook in local repository not appearing in commit message on GitHub
I have a custom Git hook in prepare-commit-msg that appends the date to the commit message so I don't have to input it myself:
#!/bin/bash
#
# Append current `date` to commit messages
echo "`...
-1
votes
1
answer
51
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
31
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
30
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
26
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
41
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
37
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
24
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
28
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
53
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 ...
5
votes
2
answers
8k
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
132
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
59
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 ...
3
votes
1
answer
78
views
When exactly in the push process does a `pre-push` hook actually run?
The docs for Git hooks state that pre-push runs "after the remote refs have been updated". My naïve reading of this is the target ref (i.e. the branch, typically) on the remote will already ...
1
vote
2
answers
111
views
Why Git pre-push does not allow me to run the input selection but fails upon select command in my interactive script?
I made an interactive pre-push git hook that before pushing allows me to bump the version in an npm package.
#!/bin/bash
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
echo "...
1
vote
0
answers
203
views
Powershell Access to Path is Denied
I have developed a git pre-commit hook for my workplace. The way it operates is as follows:
There is a pre-commit file that invokes a pre-commit.ps1 file in the same directory. Both are withing the ....
17
votes
1
answer
24k
views
Problem when trying to add Prettier's Git Hook: husky install error `install command is deprecated`
node version: 20.11.0
pnpm version: 8.15.0
os: Windows
I was following the instructions in https://prettier.io/docs/en/install.html
I ran the second command pnpm exec husky install and
cmd gives me ...
-1
votes
1
answer
57
views
What are Git Hooks and hooks in software engineering [closed]
What are git hooks and also what are hooks in general as in Software development(i.e. Server side and client side)
I wanted to have an Explaination. regarding the git hooks and also github actions ...
-1
votes
1
answer
114
views
How can I write a commit hook to cherry-pick last commit from main branch to other worktrees in a bare repo? [duplicate]
I have 3 branches called main, macos and linux. As soon as I commit something to main branch, I want to cherry-pick that commit to other two branches. I also want to do this in a bare repo.
❯ git ...
0
votes
0
answers
69
views
git ls-files not working when executing from git hooks
I'm having a wired problem with git ls-files.
I have a python script that check mandatory files are added to git using
git ls-files --error-unmatch
The python script is running on an environment I ...
2
votes
0
answers
107
views
How to add pre-receive hooks in Gitlab >= 15.11
Im trying to add a pre-receive-hook to a gitlab repository.
I have access to the instance as an administrator and the gitlab version is 16.x. so it is > 15.11.
So I was following Set server hooks ...
0
votes
0
answers
204
views
Not all lintstagedrc.json files are found in the rush.js monorepo
Expected and behavior
In a rush.js monorepo, I expect lint-staged to report problems that eslint . --fix cannot solve independently and aborts the commit.
Currently all commits go through and ...
-2
votes
1
answer
638
views
IntelliJ - Git hooks : terraform: command not found
Environment :
Pop!_OS 22.04 LTS
oh-my-zsh
IntelliJ IDEA 2023.2.5 (Community Edition)
The problem :
I have a git hook pre-commit set globally like this :
git config --global core.hooksPath <...
0
votes
2
answers
96
views
Is it possible to stop the editor from popping up once git prepare-commit-msg hook is called?
I am writing a prepare-commit-msg hook, which interactively prompts the user about some data and creates a commit message in a predefined format. In almost all cases, there is no need for the user to ...
-1
votes
1
answer
95
views
How to automatically clean the latest git-commit message from special keywords like p.e. "[build]" that are meant to trigger a CI pipeline?
In some CI setups special keywords might be used to trigger specific behavior in the pipeline. For example the CI pipelines might build feature branches if and only if the latest git commit message in ...
0
votes
0
answers
87
views
pre-commit list only conflict solved files in a merge
I have a pre-commit hook in my Git repository that runs a lint check on every .php file affected in a commit. However, this hook also runs during merge commits, affecting all files modified in the ...
1
vote
0
answers
72
views
Git hook not running in Docker on Windows system
We've got this script we must run everytime there's a Git checkout to perform database migrations. So we added it in a .git/hooks/post-checkout file:
docker exec -it my-container php db/migrate.php ...
1
vote
1
answer
535
views
Automatically deploy ASP.NET Core website to Plesk - Post-deploy script cut short
For the past days I've been trying to automate deployment of an ASP.NET Core website to a Plesk Obsidian for Windows environment. I've been struggling pretty bad with this.
In Plesk the Git extension ...
0
votes
1
answer
185
views
pre commit script for code review using spotbug
I am trying to write a script for a code review using a pre-commit hook. I am looking for a script that will run on every commit and perform the code review using SpotBugs or a similar tool. I have ...
0
votes
0
answers
402
views
Setting up GitHub Action to run only on .py files in the pull request
I am trying to setup GitHub Action that should only run on .py file in the pull request. Suppose if I am pushing any other file (say .txt) it should skip the workflow run and allow me to merge the ...
0
votes
1
answer
1k
views
how to use git hook to validate commit message according to its template
I am trying to use git hook to validate the commit messages of my team.
Its purpose is to ensure a standard for commit messages within my team so that I can generate a change log / release notes based ...
0
votes
1
answer
319
views
Which Git Hooks are supported by the VS Code built-in Git extension?
It would seem to me that only a few of the Git hooks are supported by the built-in Git extension for VS Code, for example, pre-commit and pre-base hook seem to be, yet others like post-checkout, post-...
0
votes
0
answers
145
views
Husky precommit does not run in Windows when using NVM
Followed all the Husky instructions, installed Husky, checked the husky directory was there, but when using nvm in windows, the pre-commit hook does not run. Also used the .huskyrc script suggested in ...
-1
votes
1
answer
48
views
Git hooks: How to force a file change to be included?
I want to force a *.md change if anything is committed to a specific branch.
A CHANGELOG.md where a commit must be translated to non-tech support staff.
Pseudo code
if branch == master && ...
1
vote
1
answer
207
views
Google Cloud Build Doesn't Work Properly on Git Hooks
Im using gcloud and I have a git server on a vm, where in a repository through a git hook (post-receive), Im calling cloud build to triggers the construction of a docker image and the deployment of ...
1
vote
0
answers
51
views
GIT: dealing with pre-receive hook during merge
I have problem with pre-receive hook. My hook checks if commits pushed to the branch contain jira ticket or specific tag. And it works fine. Unfortunately, when I create Pull Request (I'm working with ...
0
votes
1
answer
44
views
Git Pre-Receive Hook Handle Git Rebase
I have a git pre-receive hiook and I was it to be able to determine if a push contains a rebase. I can't seem to find a definitive way to handle this online and wondering if anyone would have any ...
0
votes
1
answer
83
views
Git hooks do not run
I want to run post-receive hook to notify Jenkins to start a new build, but I cannot make Git hooks to run automatically.
I tried example hooks in .git/hooks repository, by removing .sample but none ...
0
votes
1
answer
5k
views
How to disable ktlint max-line-length standard rule
I'm using ktlint 0.50.0, with Spotless 6.20.0, on AGP 8.1.0. Running spotless as a PreCommit Git hook.
Due to the existence of too many old code, I'm trying to disable some rules.
The one that gives ...
0
votes
1
answer
88
views
Source control and terminal conflict (version.json typechange)
I encountered an error when attempting to commit via the VSCode source control. The OUTPUT tab revealed that Git was searching for version.json (which is a symlink) with the incorrect path. After some ...
0
votes
0
answers
65
views
Modify File/Git index in pre-merge-commit
I want to change a respository file in a pre-merge commit before it is commied.
This should not necessarily have been changed by the merge.
The git hook will be more complex later, but the simplest ...
0
votes
1
answer
49
views
Fetch refs not associated with a branch
I have a program that runs some scientific tests. I have written a git post-receive hook for the server that runs these tests:
When it receives a commit, e.g. deadbeef..., run the program
Commit the ...
0
votes
0
answers
65
views
Why command 'git log -g' not run correctly in git server side?
Localy the command git log -g --pretty=%H $refname return the hash commits of the new branch is ok but the same commmand return null when run inside the post-receive hook in server-side. If I remove '-...
0
votes
1
answer
100
views
git init doesn't execute hooks
I am following the steps outlined in the below link to ensure that my hooks are rerun every time upon git init:
Getting started with Ctags with Vim and Git.
Since I don't have fish installed, I ...