See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| # capture info messages and any errors in a log file | |
| exec >> log/hooks-out.log 2>&1 | |
| if git diff-tree --name-only --no-commit-id ORIG_HEAD HEAD | grep -q 'package.json'; then | |
| echo "$(date): reinstalling deps since package.json changed" | |
| yarn > /dev/null | |
| else | |
| echo "$(date): no changes detected in package.json" | |
| fi |
| watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache |
| #!/usr/bin/env bash | |
| # fork from https://gist.github.com/jakemhiller/d342ad51505addf78ec628a16fd3280f | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)" | |
| check_run() { | |
| echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
| } | |
| check_run package.json "npm prune && npm install" |
You don't have to delete your local branch.
Simply delete your remote tracking branch:
git branch -d -r origin/<remote branch name>
(This will not delete the branch on the remote repo!)
See "Having a hard time understanding git-fetch"
there's no such concept of local tracking branches, only remote tracking branches.
| #!/usr/bin/env bash | |
| # MIT © Sindre Sorhus - sindresorhus.com | |
| # git hook to run a command after `git pull` if a specified file was changed | |
| # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
| check_run() { | |
| echo "$changed_files" | grep --quiet "$1" && eval "$2" |