Created
October 17, 2014 14:34
-
-
Save hcurotta/1d5686b19d0c1c631a0d to your computer and use it in GitHub Desktop.
Post Merge git hook to trigger codeship deployment when using BitBucket
This file contains 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/bash | |
branch_name=$(git symbolic-ref --short HEAD) | |
if [ "$branch_name" == 'dev' ] || [ "$branch_name" == 'staging' ] | |
then | |
git commit --allow-empty -m 'empty commit to trigger deployment' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Due to a bug in BitBucket's webhook feature, merge commits are not reported correctly to Codeship. Our workaround is to force an commit to occur after each merge action.
This is done with a post-merge git hook which creates an empty commit automatically after merging into either dev or staging branches.
To use, copy this file to .git/hooks and make it executable. Note it must be called
post-merge
with no file extension.