Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env php
- <?php
- $branches_to_skip = array( 'master', 'develop' );
- $the_branch = shell_exec( 'git symbolic-ref --short HEAD' );
- $the_file = 'somefile';
- if ( file_exists( $the_file ) && ! in_array( trim( $the_branch ), $branches_to_skip ) ) {
- echo "The file was found and you are on the {$the_branch} branch\r\n";
- unlink( $the_file );
- echo "{$the_file} was removed\r\n";
- } else {
- echo "The {$the_file} doesn't seem to exist or your on {$the_branch} so it's all good nothing was changed\r\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement