Skip to content

Instantly share code, notes, and snippets.

@nikolaykasyanov
nikolaykasyanov / pre-commit
Last active March 28, 2023 12:36
Useful pre-commit hook for submodules
#!/bin/sh
if git status | grep -i 'HEAD detached' > /dev/null 2>&1; then
echo "You should not commit while in detached state, either create a new brach or checkout existing one before committing."
exit 1
fi
@dberstein
dberstein / README.md
Last active November 12, 2023 09:01
Git commit hook that prepends message with Jira issue(s) found in branch name (PR branch) otherwise requires message contains at least one Jira issue

With this commit-msg git hook and your branch names have Jira reference(s), your commit messages will be automatically updated to include any missing reference(s) too.

Installation

Place contents of this gist's commit-msg file into your checkout's .git/hooks/commit-msg file and make it executable.

Bash

cd path/to/your/git/checkout \
&& install -vbm 755 <(curl -s https://gist.githubusercontent.com/dberstein/dcc50e171163c3f6e0f23b2b5de5dd49/raw/5e5372ff22a872321ad1f5469a4d579c15ce498a/commit-msg) "$(git rev-parse --git-dir)/hooks/commit-msg"
@farbod-s
farbod-s / fix_mac_app.sh
Last active November 3, 2023 00:48
How to Fix App “is damaged and can’t be opened. You should move it to the Trash” Error on Mac
# Bypass MacOS Gatekeeper
#------------------------
#usage: xattr [-l] [-r] [-s] [-v] [-x] file [file ...]
# xattr -p [-l] [-r] [-s] [-v] [-x] attr_name file [file ...]
# xattr -w [-r] [-s] [-x] attr_name attr_value file [file ...]
# xattr -d [-r] [-s] attr_name file [file ...]
# xattr -c [-r] [-s] file [file ...]