> On Fri, Apr 14, 2023 at 04:38:34PM +0200, Uwe Brauer wrote:

> Well, your approach is incorrect. ;-)
> A correct one is going to be quicker, too.

> As I've explained in this list in the past, _by default_ Git implements
> asymmetric approach to handling remote repositories and branches they
> contain - you might want to re-read [1] and may be the whole thread; may be
> this idea will now have greater chances to really sink in as you will be
> able to compare and contrast "normal" clone and "mirror" clone.

So let me see whether I understood git's philosophy correctly:

    1. A ┬źnormal┬╗ clone results in:

       1. All data (I say data not files) are downloaded

       2. But not necessarily all references (branches):

          1. References to remote branches are available and

          2. The reference to the main (the branch that points to HEAD
             on remote) is also available, might be: master/main/stable
             or whatsoever

       3. If I want to checkout a branch that corresponds to remote
          branch the correct way (without shortcuts would be)

  git branch feature origin/feature # create local branch off a remote one
  git checkout feature              # check local branch out
  git branch -u origin/feature      # make current branch track origin/feature

This would syntax would also work if I set  a new remote

gitlab  g...@gitlab.com:kalthad/matlab-emacs.git (fetch)

Then that would be:

  git branch feature gitlab/feature # create local branch off a remote one
  git checkout feature              # check local branch out
  git branch -u gitlab/feature      # make current branch track gitlab/feature

* Mirrors and bare repositories

A more mercurial like clone would be using the mirror option.
Such a repository has *no* remote  branch tracking, but  all branches are 

However the repository is bare, no commits are displayed.

I can change a bare repository to a normal one
    1) mkdir .git
    2) mv all stuff in the .git directory
    3) git config --local --bool core.bare false
    4) git reset --hard

However it seems that there is no remote branch tracking and that is why
it seems not wise to use such a repository for development

Is this so far correct?


Uwe Brauer 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to