0

When cloning a repositoy with --bare git log has no status about the remote branches. There might be a good reason for it but I don't get it. git fetch origin seems to be successful but the remote branches are still mising in the log.

EDIT: I mean I can add fetch = +refs/heads/*:refs/remotes/origin/* to the [remote "origin"] section in the configuration (git config --edit) but it doesn't feel right.

ploth
  • 435
  • 8
  • 16

1 Answers1

1

Bare repositories do not normally have remote-tracking names (such as origin/master) for the same reason they do not have a work-tree: you're not supposed to do any work in them.

Remote-tracking names are useful for doing work. They let you compare your current branch to its upstream, when its upstream is set to the corresponding remote-tracking branch. But for that to be useful, you'd have to git checkout some branch locally, to create it, and then do some work. With no work-tree, you can't do that. So that's not useful after all, so there's no need for a remote-tracking name either.

If you do have some weird scenario in which you really do want remote-tracking names in a bare clone in which you do no work, just add the fetch line you mentioned in your edit.

torek
  • 448,244
  • 59
  • 642
  • 775