title: How to push to upstream in Git?
body: <p>I have a project with a few friends in GitLab, and there is of course the master branch, and there are some others too. When I cloned the repository, I created also an upstream with the command <code>git remote add upstream ...</code>. </p>
  
  <p>Then, I issued the <code>git fetch upstream</code>. Followed by <code>git checkout upstream/test1</code>. Now, if I type <code>git branch -a</code>, I get an output like this:</p>
  
  <pre><code>* (HEAD detached at upstream/test1)
    master
    remotes/origin/HEAD -&gt; origin/master
    remotes/origin/master
    remotes/upstream/test1
    remotes/upstream/master
  </code></pre>
  
  <p>This is all fine, but then I did some changes to the code in my <code>upstream/test1</code> branch. I don't want yet to push them to <code>origin/test1</code>, but I want to be able to push my changes to <code>upstream/test1</code> so that my other friend can see it. But, if I issue the following set of commands:</p>
  
  <pre><code>git add .
  git commit -m "Sample message"
  </code></pre>
  
  <p>After the commit I got the message:</p>
  
  <pre><code>[detached HEAD 4f20e95] Sample message
   5 files changed, 12 insertions(+), 1 deletions(-)
  </code></pre>
  
  <p>And the hash value changes to <code>4f20e95</code> in my command prompt. Then if I do <code>git push</code>, I get the following error messages:</p>
  
  <pre><code>fatal: You are not currently on a branch.
  To push the history leading to the current (detached HEAD)
  state now, use
  
      git push origin HEAD:&lt;name-of-remote-branch&gt;
  </code></pre>
  
  <p>How can I push to my upstream branch without actually pushing to origin.</p>