![]() This is the problem that brought me to this thread (the opposite of the one in the question): I cloned a repo with GitHub client gh repo clone USER/REPO and it added automatically "upstream", the repository forked from, restricted only to the branch "master". NOTE: If a branch is not in the list of branches of a remote (visible in git remote show or the config file), then you will not be able to have a reference to it, git will save it to the temporary FETCH_HEAD and you will not be able to track it or to use it directly in git checkout. It will contain a section like: Įditing the config file will work to change the restrictions but I agree with that is not a good idea. You can check the branch restrictions in a remote also by listing the known remote branches with git branch -r, in combination with grep if you have many remotes, or by checking the remote details in the git config file. It prints the list of branches under "Remote branch:" and also tells you if they have been fetched and if they are tracked. The best command to check a remote and the branches that have been already or will be fetched is git remote show. # without -b the local branch name is guessed to be the same as the remote one # then you can omit it and still only will be fetched # If you set only one in the restrictions above (i.e no option 4), ![]() Buth then you'll have to mention the remote branch all the remote branch all the time you fetch the remote_repo.Īfter setting the remote you can fetch the remote branch, checkout and pull: You could also skip the restrictions because clone by default fetches only the main branch and remote add does not fetch branches. ![]() branch_v\* matching branch_v1, branch_v2. # you can add multiple branches with multiple -add lines # with -add it will add the branch instead of setting it
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |