build-ignore
Advanced tools
Comparing version 1.1.7 to 1.1.8
{ | ||
"name": "build-ignore", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "A script that generates a .gitignore based on branch name for when different .gitignores are needed", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,6 +24,23 @@ # Build-Ignore | ||
Consider using a githooks module like [husky](https://www.npmjs.com/package/husky) to have code run automatically with post-checkout hook. | ||
#Git hooks | ||
Use as a post-checkout git hook to have build-ignore run automatically when changing branches by adding the following to the `.git/hooks` directory: | ||
``` bash | ||
#.git/hooks/post-checkout | ||
#!/bin/sh | ||
BRANCH_SWITCH="$3" | ||
#check if it was a branch checkout | ||
if [[ $BRANCH_SWITCH -eq 1 ]] | ||
then | ||
./node_modules/.bin/build-ignore | ||
fi | ||
``` | ||
// Edit package.json | ||
![terminal](https://media.giphy.com/media/OBk7HYOkMCu2Y/giphy.gif) | ||
Alternatively, you can use a githooks module like [husky](https://www.npmjs.com/package/husky) and add the following to your package.json scripts section. | ||
``` json | ||
{ | ||
@@ -35,3 +52,1 @@ "scripts": { | ||
``` | ||
![terminal](https://media.giphy.com/media/G7VwLIwql0Ai4/giphy.gif) |
3214
51