Back

Explore Courses Blog Tutorials Interview Questions
+7 votes
3 views
in DevOps and Agile by (29.3k points)
edited by

I created a local branch for testing Solaris and Sun Studio. I then pushed the branch upstream. After committing a change and attempting to push the changes:

$ git commit blake2.cpp -m "Add workaround for missing _mm_set_epi64x"

[solaris 7ad22ff] Add workaround for missing _mm_set_epi64x

 1 file changed, 5 insertions(+)

$ git push

fatal: The current branch Solaris has no upstream branch.

To push the current branch and set the remote as upstream, use

    git push --set-upstream origin solaris

Why do I have to do something special for this?

Is there any reasonable use case where someone would create <branch>, push the <branch> to remote, and then claim a commit on <branch> is not supposed to be for <branch>?

1 Answer

+7 votes
by (50.2k points)

For this question, you need to push it with the -u (short for --set-upstream) option:

git push -u origin <branch>

Note: Git will set up tracking information during the push.

thus you can push the files to the branch.

What is Upstream?

An upstream is simply another branch name, usually a remote-tracking branch, associated with a (regular, local) branch.

git push upstream - why do I have to git push --set-upstream origin ?
Intellipaat-community
by (19.4k points)
Thank you. Straight forward answer. Helpful.

Browse Categories

...