Noting that i've executed:
git fetch
and
git fetch --prune
Same result.
I got confused in the beginning thinking i had created duplicate branches, but in the repo page, there's only one master. (Even 'dev-daal' is deleted)
EDIT 1:
I tried doing
git fetch --all
and now I have two versions of everything:
CodePudding user response:
The git branch -r
command lists your remote-tracking names. Git calls them "remote-tracking branch names" in some of its documentation, but despite Git's extreme overuse of the word "branch", remote-tracking names are not branch names in one very important sense. That's why I like to leave out the misleading word and just call them "remote-tracking names".
In any case, there are several things to know about remote-tracking names:
They're in your repository. They don't necessarily mean anything about any other repository, except for the next point.
Your Git software creates or updates them, in your repository, when your Git software connects to other Git software that is working with some other Git repository, and that other Git software tells your Git software that the other repository currently has some branch names. Since branch names are temporary and meaningless, but useful for locating commits (which are permanent and meaningful), your Git software copies those names to your repository, so that you can use their names. But since those are their branch names, not yours, your Git renames their branch names.
The name you get—the remote-tracking name—is made by taking the name you use to talk to their Git software, such as
origin
orDaal-Backend
, adding one slash/
, and then using their branch name. So if your Git software is using the nameDaal-Backend
to talk to some other Git software, and that other Git software tells you that, at this very instant, they have a branch namedmaster
, your Git will create or update the nameDaal-Backend/master
in your repository so that you can easily retrieve the hash ID of the commit that they are currently callingmaster
.
If they—whoever they are—rename their master
, your Git will pick up the new name the next time your Git calls up their Git and converses with them about their branch names. At that time, your Git software will create a new name, Daal-Backend/main
for instance, based on their new name. Your Git won't delete your old name unless you tell it to.
Likewise, if they delete their master
entirely (which they could do if they wanted: there's nothing special about the name master
) and your Git calls up their Git, your Git won't do anything, because your Git is not seeing their master
any more. You must tell your Git if you talk to them and they don't have that branch name at all, delete my copy. You would do this with git fetch --prune Daal-Backend
. That has your Git ask their Git about all their branch names, creating or updating your remote-tracking names as appropriate and also deleting any stale, left-over names.
Note that this all assumes that you're having your Git software use the name Daal-Backend
to call up their Git software. Should you now use the name origin
—as in git fetch origin
—to call up any other Git software, whether it's theirs or not, and get information about another repository, this time your Git software will create and/or update your origin/*
names.
So it's all up to the name you use to contact what Git calls a remote. A remote is just a short name for some other Git repository: the remote hangs on to the URL. You will use git remote add
to add a remote, or git remote remove
to remove a remote. The existence of that remote, plus you running git fetch
, plus the existence of the branch names on that remote, is what causes you to have remote-tracking names.
CodePudding user response:
You've got two remotes. Say git remote -v
to see a list. If they are two names for the same URL, you can remove one.
git remote rm Daal-Backend