Skip to content

Instantly share code, notes, and snippets.

@mlocher
Forked from hcurotta/post-merge
Last active August 29, 2015 14:07
Show Gist options
  • Save mlocher/8235a0a871322d3d8bfe to your computer and use it in GitHub Desktop.
Save mlocher/8235a0a871322d3d8bfe to your computer and use it in GitHub Desktop.
BitBucket post-merge hook
#!/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
@mlocher
Copy link
Author

mlocher commented Oct 17, 2014

All credit goes to @hcurotta, I only forked it so I'll find it again ;)

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