1

I made a local git repo(git init), and made some commits in it.

Then I made a repo on github and made my local repo colaborate with it:

git remote add origin url-of-my-remote-gitrepo

I pushed the local commits to remote git repo:

git push origin master

Now I cloned remote git repo into another directory on my computer.

So now I have two local git repos associated with same remote repo.

When I do:

git log --decorate

First repo shows all branches I made and origin/master.But second one shows origin/HEAD also.

Whys is this the case?

Mandroid
  • 6,200
  • 12
  • 64
  • 134

1 Answers1

1

Because you push only your local master branch to your remote GitHub repo.

And if your remote repo only includes that one branch, that is the one you see in your second repo.

A git push --all -u would have pushed all branches.
And even then, in your second repo, you would need (to see all branches):

git log --decorate --graph --oneline --all --branches
                                     ^^^^^^^^^^^^^^^^
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    But why is that first repo doesn't show origin/HEAD but second one does. – Mandroid Jan 20 '18 at 09:26
  • 1
    @Mandroid Because your first repo did not clone the GitHub repo: see https://stackoverflow.com/a/17609521/6309 which references https://stackoverflow.com/a/8841024/6309. Your second repo did clone the remote GitHub one, and has consequently a `origin/HEAD`. – VonC Jan 20 '18 at 10:21