Search code examples
egit

Push new branch upstream


I have a local repository and a remote repository on Github. I just created two new local branches, Documentation and Development, using origin/master as the upstream source.

How do I push these new branches upstream. I have made no changes in the new branches yet so there is no new content, simply the branches themselves.

Right now I want to create a new topic branch using origin/Development as the upstream but it is not there yet.


Solution

  • You don't need any new commits on the branch to do a push. The key for creating and tracking corresponding branches on the remote is using the --set-upstream flag.

    $ git checkout -b Documentation
    $ git push --set-upstream origin Documentation
    

    Short flag form:

    $ git checkout -b Documentation
    $ git push -u origin Documentation