title: Git command to check if a remote branch is brand new or has had any commits to it?
body: <p>I set up a Bitbucket webhook which is triggered on any push to a specific repository, which includes creating a branch. What I need to do is ignore any time the webhook is triggered specifically by a new branch being created. The issue is when someone creates a branch locally and commits to that local branch, once they push that local branch remote it triggers the webhook on that branch for the first time, essentially causing the same behavior as when a branch is initially created remotely without any commits.</p>
  <p>My initial idea was to use git <code>name-rev --name-only &lt;commit sha&gt;</code> on the latest commit for a branch. This spits out the branch name on a commit, so I could compare the current branch name to the result. The problem is commits of pull requests don't work super well with the command, so it doesn't cover all edge cases.</p>
  <p>My next idea was to use <code>git rev-list --count &lt;branch&gt;</code> and count the number of commits on a specific branch, and if the result was 0, I would ignore the branch. However I can't seem to figure out how to get all remote commits pushed specifically to one remote branch, including those which have eventually been merged.</p>
  <p>Does anyone have a good way to tell if a branch is newly created with zero commits pushed to it?</p>