Last active
January 17, 2020 12:39
-
-
Save shaharkazaz/b902ddee9b826f4b6a6dfdc66cae0233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const chalk = require('chalk'); | |
| const {exec} = require('./exec'); | |
| /* The flag commit hash 🚩 */ | |
| const stgUniqCommit = "s76o527m89e9h72619a827s9h038c029o8de"; | |
| const currentBranch = exec('git rev-parse --abbrev-ref HEAD'); | |
| /* Get all the branch names that have a commit with this hash */ | |
| const branchesWithStaging = exec(`git branch --contains ${stgUniqCommit}`); | |
| if (branchesWithStaging.includes(currentBranch)) { | |
| console.log(chalk.bgRed.black.bold(`Your branch contains commits from 'staging' branch.`)); | |
| process.exit(1); | |
| } | |
| /* Update local branch from origin master */ | |
| exec('git pull origin master'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment