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 If you are adding the branch restriction to an existing remote in your working directory.If you are adding a new remote to your working directory.Git clone -single-branch -branch remote_branch remote_url If you are cloning a new repository (e.g.If you want to update and track the branch you have to set first the remote and there are 4 alternatives:.to merge GitHub Pull Requests, where is like ), then you can use: If it is a one time deal from a different repository and you don't need a reference (e.g.The reply depends on what you want to accomplish. Switched to a new branch 'release-20.10.08' WM-C02WM0T3HTD8:vdca_android_20_10_04_stable zgong$ git checkout -b release-20.10.08 origin/release-20.10.08įatal: 'origin/release-20.10.08' is not a commit and a branch 'release-20.10.08' cannot be created from it Please make sure you have the correct access rights name:directory zgong$ git fetch release-20.10.04 release-20.10.04įatal: 'release-20.10.04' does not appear to be a git repositoryįatal: Could not read from remote repository. Here, I tried to fetch release-20.10.08 successfully. Create and checkout a new local branch with "checkout -track", which will be given the same "branch_name" as a tracking branch:įetch the remote branch of the target branch: git fetch origin branch-nameĬheck out the target branch: git checkout -b branch-name origin/branch-name.Note: only after the new tracking branch was fetched from the remote, you can see it in the tracking branch list with git branch -r. Fetch the branch you have added from the remote:. If not (as in my case with a single branch clone), add this branch to the tracking branch list by "git remote set-branches" with -add option: Check with git branch -r whether you can see this branch as a tracking branch.In case the remote exists, and the branch you want to fetch exists in that remote: As "git remote add" sets up a new remote, it obviously doesn't work with the existing remote repository supplying "-t branch" options didn't help me. I am a little bit bewildered by advises to tweak git config manually, as well as by typing git remote add commands. Let's suppose I have cloned the remote with -single-branch option previously, and in this case the only one tracking branch I have is the "cloned" one. You can fetch a specific branch from remote with git fetch only if the branch is already on the tracking branch list (you can check it with git branch -r). The answer actually depends on the current list of tracking branches you have.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |