Limit POST Hook to git branch, not repository, on Bitbucket

Complicated title, let me explain.

I want to limit an automatic POST hook when I push to the master branch; so it won’t fire when I push to the dev branch. This is so the app will only deploy to the live servers when the changes have been merged with master and the new master passes the unit tests.

  • Remove .pyc files from Git remote repository
  • Mingw+msys2 : Failed to connect to : Network is unreachable
  • SSL error between jenkins(java) and Bitbucket Plugin
  • How to use Bitbucket and GitHub at the same time for one project?
  • How pull changes from github to bitbucket after initial import?
  • Can I issue git rev-parse on remote repository without a local copy?
  • Is this possible?

  • Git is failing to push in puttycyg because of SSH error
  • Using git in iPhone projects
  • How does GitHub change the URL without reloading a page?
  • How to move files from one git repo to another (not a clone), preserving history
  • Can I tell git pull to overwrite instead of merge?
  • Git tracking block of code moved/removed in a file
  • One Solution collect form web for “Limit POST Hook to git branch, not repository, on Bitbucket”

    You can’t limit when BitBucket fires its POST hook; but you can use the contents of the POST to make the decision about whether or not to proceed with the deployment. Just parse the JSON that BitBucket sends you and only continue if any of the "commits" elements have a "branch" of “master”, for example.

    Git Baby is a git and github fan, let's start git clone.