Skip to content

Instantly share code, notes, and snippets.

@hcurotta
Created October 17, 2014 14:34
Show Gist options
  • Save hcurotta/1d5686b19d0c1c631a0d to your computer and use it in GitHub Desktop.
Save hcurotta/1d5686b19d0c1c631a0d to your computer and use it in GitHub Desktop.
Post Merge git hook to trigger codeship deployment when using BitBucket
#!/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
@hcurotta
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment