Find Git branch name in post-update hook [duplicate]

The first parameter to the post-update hook is the branch reference in full – for instance I see ‘refs/heads/master’ for a push to ‘origin master’. So an example hook script that just prints the branch modified is: #!/bin/sh branch=$(git rev-parse –symbolic –abbrev-ref $1) echo Update pushed to branch $branch exec git update-server-info To illustrate, when … Read more

Local executing hook after a git push? (post-push)

Another solution to this problem is to have a wrapper for git push that executes .git/hooks/pre-push and .git/hooks/post-push scripts before and after the git push call. A possible wrapper could look like this: #!/bin/sh GIT_DIR_=”$(git rev-parse –git-dir)” BRANCH=”$(git rev-parse –symbolic –abbrev-ref $(git symbolic-ref HEAD))” PRE_PUSH=”$GIT_DIR_/hooks/pre-push” POST_PUSH=”$GIT_DIR_/hooks/post-push” test -x “$PRE_PUSH” && exec “$PRE_PUSH” “$BRANCH” “$@” git … Read more

How to remove git hooks

I figured out what was causing that: I had created my pre-commit hook in git core directory, but the git had created a pre-commit hook in project’s .git/hooks/ directory. I just removed it. It means running the command that @romin21 mentioned inside project’s root directory: rm -rf .git/hooks

change default git hooks

With git 2.9, you have a new option made for centralizing hooks: core.hooksPath See commit 867ad08, commit de0824e, commit bf7d977, commit 49fa52f (04 May 2016) by Ævar Arnfjörð Bjarmason (avar). (Merged by Junio C Hamano — gitster — in commit 6675f50, 17 May 2016) The git config documentation now includes: core.hooksPath By default Git will … Read more

black as pre-commit hook always fails my commits

(author of pre-commit here) the framework intentionally does not provide a way to auto-commit modifications. Here’s a few issues which have asked for such: pre-commit/pre-commit#806 pre-commit/pre-commit#747 A comment from one of those issues: pre-commit itself will never touch the staging area. These are good ways to silently break commits. In my mind this is one … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)