-
-
Save mijdavis2/09b6ff4e082faa3e3416d3e663084dd7 to your computer and use it in GitHub Desktop.
Git pre-commit hook to help stay up-to-date with master
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
| #!/bin/sh | |
| # hook to enforce that current branch is up-to-date with latest | |
| # changes from master before committing | |
| # put me in .git/hooks and make me executable | |
| # the output of rev-list in the following test will be empty if there | |
| # are no commits in master that aren't in the current branch | |
| if [ ! -z $(git rev-list ..master) ] | |
| then | |
| echo "abandoning commit... it looks like this branch is out of date" | |
| echo "please merge from master and try again" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment