On Sat, Sep 22, 2018 at 10:30 PM Emmanuel Charpentier
<emanuel.charpent...@gmail.com> wrote:
> Le samedi 22 septembre 2018 22:19:32 UTC+2, Erik Bray a écrit :
>>
>> Try
>>
>> $ git branch -d origin/u/embray/python3/sage-rings-polynomial-polydict
>
>
> No such luck :
>
> charpent@asus16-ec:/usr/local/sage-8$ git branch -d 
> origin/u/embray/python3/sage-rings-polynomial-polydict
> error: branche 'origin/u/embray/python3/sage-rings-polynomial-polydict' non 
> trouvée.
>
> It seems that I'm still stuck (in the mud above the axles...).
>>
>>
>> You wouldn't have the above branch without "origin" unless you created a 
>> remote tracking branch. It's only remote branches which you're having a 
>> problem with
>
>
> Being remote, it seems that I can't access them...

That's not what "remote" means in this case.  When you fetch branches
from a remote repository, you (typically) will have those branches
also in your local repository.  It's just that they are synced to a
.git/refs/ subdirectory called remotes/<remote-name>/.  This is what I
mean in this case by "remote branch".  Not that it's literally
something on a remote machine that you "can't access".  Normally "git
branch" hides remote branches, but "git branch -r" shows all remote
branches.

One thing I forgot is that `git branch -d` will normally only delete
"local" branches (that is, branches that you manually created locally
rather than fetching from a remote). But "git branch -d -r
<remote-name>/<branch-name>" will let you delete remote references as
well, so that would have worked.

I still recommend, by default, only fetching your own branches unless
you frequently need to check out other people's branches (and even
then you can still fetch them manually).  In your .git/config each
remote has its own section like:

[remote "origin"]
    url = g...@git.sagemath.org:sage.git
    fetch = +refs/heads/*:refs/remotes/origin/*

the "fetch = " line is called a refspec, and it specifies mapping of
refs to sync from the remote repository when you do a "git fetch
origin", to how it should store those refs locally.

refs/heads/ is where normal "local branches" go ("heads" should
probably be renamed "local" or "branches" or something, but that ship
has sailed), whereas, as I wrote above, "refs/remotes/<remote-name>/"
is where remote branch refs go by default.  So the above line is just
a wildcard expression saying "take everything on this remote
repository under refs/heads/*, and map it to the same name locally
under refs/remotes/origin".

You can have more than one refspec like:

[remote "origin"]
    url = g...@git.sagemath.org:sage.git
    fetch = +refs/heads/develop:refs/remotes/origin/develop
    fetch = +refs/heads/master:refs/remotes/origin/master
    fetch = +refs/heads/u/embray/*:refs/remotes/origin/u/embray/*

I then also have numerous remote tracking branches, which is another
story.    This is all documented in more detail at:
https://git-scm.com/book/en/v2/Git-Internals-The-Refspec

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to