title: Git: fatal:The current branch XXX has no upstream branch (but it HAS the upstream branch)
body: <p>We use git + Jira + Bitbucket.</p>
  
  <p>Scenario:</p>
  
  <ol>
  <li><p>In Jira I've created (with <code>Create branch</code> option) branch <code>XXX</code>.</p></li>
  <li><p>In Bitbucket I see that the branch <code>XXX</code> is appeared in the list of branches.</p></li>
  <li><p>Make changes in the code => <code>git commit</code>.</p></li>
  <li><p><code>git push</code> gives: <code>fatal: The current branch XXX has no upstream branch.</code></p></li>
  </ol>
  
  <p>Question: what is the reason of this error? The branch <code>XXX</code> <strong>has</strong> the upstream branch (I see this upstream branch <code>XXX</code> in the Jira.)</p>
  
  <p>Please note: before this error I've used <code>git push</code> with NO additional arguments.</p>
  
  <p>UPD0: @RadioSilence has suggested to use <code>git branch -vv</code> command! I did and it helped me to see that "the local branch is not tracking the upstream". And the <em>reason of it</em> was (very probably) some of my previous git commands on that branch, which apparently caused disabling the tracking of the upstream by this branch. (By default after checking out any branch created with Jira the branch <strong>is</strong> tracking the upstream, hence NO additional commands/options are needed for <code>git push</code>.)</p>
  
  <p>As a result (solution):</p>
  
  <ol>
  <li><p>I've changed the name of the branch caused the issue from <code>XXX</code> to <code>XXX_01</code>.</p></li>
  <li><p><code>git checkout XXX</code> => add changes (via <code>git stash apply stash@{0}</code>) => <code>git commit</code>.</p></li>
  <li><p><code>git push</code> (with NO additional commands/options) and it worked as expected.</p></li>
  </ol>
  
  <p>P.S. If anyone knows how it was possible to <em>unintentionally</em> disable the tracking of the upstream by the branch (created with Jira), please let us know.</p>