title: Increment a number in Bitbucket pipelines
body: <p>I have a <code>netcoreapp1.0</code> that I build using Bitbucket pipelines and pack with <code>dotnet pack</code>, and push to Octopus deploy as a package <em>MyAssembly.Api.1.0.0-beta-*.nupkg</em> where <code>*</code> is supposed to be a commit number/build number (or any other stable incremented number).</p>
  
  <p>Since the commit identifiers in GIT are UUIDs, I have tried the following commands (see below) to get the commit count, but the resulting commit count is very unreliable and does not work as expected. Locally I get it working just fine and the commit count is incremented for every commit I make to my local repo. Unfortunately, none of the commands work in the pipeline (running in a Docker container). For some reason the commit count stays the same or even decreases sometimes. </p>
  
  <p>I read somewhere that it has to do with "shallow/unshallow" git repo <em>blabla</em>..., and that it might be solved by logging in (to GIT) every time. I do not wish to do this if I can avoid it, and I find it kinda ironic that I would need to login to GIT within Bitbucket itself.</p>
  
  <pre><code>git shortlog | grep -cE '^[ ]+\w+'
  git rev-list HEAD --count
  git rev-list --all --count
  git rev-list --no-merges --count HEAD
  git log --pretty=format:'' | wc -l
  git log master --pretty=oneline | wc -l
  </code></pre>
  
  <p><strong>Q: Is there any other way to increment a value and access it as a variable in a pipeline?</strong></p>