title: How to get the current git branch in shell
body: <p>I'm trying to write a shell script that should fail out if the current git branch doesn't match a pre-defined value.</p>
  
  <pre><code>if $gitBranch != 'my-branch'; then
     echo 'fail'
     exit 1
  fi
  </code></pre>
  
  <p>Unfortunately, my shell scripting skills are not up to scratch: How do I get the current git branch in my variable?</p>