SimpleGuy SimpleGuy - 2 months ago 6
Git Question

GitHub: 'master' not visible in List of branches

I am very new to Git.


  • I created a new repository -
    Tutorial

  • Under that I created two branches -
    demo-branch
    and
    tutorial-branch
    , one by one, and did some changed and pushed

  • I checked in GitBash, that I have three branches -
    master
    and above two



enter image description here

However, when I visit GitHub online in browser, it shows me only two branches
enter image description here

enter image description here

Why is
master
branch not shown ? Am I conceptually missing something ?

Answer

If you didn't push master to GitHub, you can't see master branch on GitHub.

I assumed you created Tutorial repo from bash, not from GitHub. master branch is automatically created by Git on a new repository but not pushed. To get the branch on GitHub do git push origin master:master.

This command push onto origin git repository the local branch master to remote branch master and create it if needed.

  • origin is the default name of remote repository. In your case this is your GitHub repository.
  • Local master branch is your ... local master branch
  • Remote branch master is the branch on origin remote, so GitHub. This one is updated when user push onto master branch

You can find more details on Git push SO Documentation