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.

  • Can't create new branch.Unknown protocol
  • Merge-only Branch on BitBucket/GitLab/GitHub?
  • git repository clone failed. Connection Reset
  • Looking for a BitBucket Workflow
  • How do I view older iterations of binary (image or non-code) files from a git repository?
  • Git Workflow with Bitbucket
  • Is this possible?

  • avoid git merge conflicts due to per-user settings in Makefile
  • Visual Studio 2013 and BitBucket
  • GIT - Difference between tracking a branch versus cloning
  • Git diff, no new line, what is changed?
  • applying email patch with git
  • gitpython: Command syntax for git commit
  • 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.