If there are multiple branches, the relationship between their various cut-offs is complicated (it's all based on graph walking and without code inspection or testing, it's hard to say how Git will behave in some tricky cases). If you run git fetch with a specific -depth or -deepen, Git will make new shallow cut-offs as needed to set the depth to the number you specify, or increase any existing shallow cut-offs by the number you specify. This is independent of whether the clone behaves like a -single-branch clone. git/shallow file entirely, and the clone behaves like a non-shallow clone. If you run git fetch -unshallow, Git will find all the shallow cut-offs and re-fetch all history from before this point. The behavior of future fetches, especially those that use a different reference name, is hard to predict from this. These affect the overall usefulness of the clone (but much less so in any modern Git) for more about this, see Is it safe to shallow clone with -depth 1, create commits, and pull updates again? For here, though, note that this does not retain the -depth number. Then, having configured all future fetch operations to be single-branch, the shallow clone fetches with your specified -depth, which inserts special "graft" entries using a file named. The fetch syntax I used can roughly be described as source:target. Now you should be able to check out the newly fetched branch. Which tells each later git fetch to bring over every branch. Alternatively you can fetch all remote branches by replacing with.This tells later git fetch commands to bring over only the given, and no others.Ī normal (non-shallow, non-single-branch) git clone uses the default setting: git config '+refs/heads/*:refs/remotes/origin/*' If you do not also cancel this out with an explicit -no-single-branch, Git will configure the fetch line, as if you had run: git config +refs/heads/:refs/remotes/origin/ In particular, -depth 1 has the side effect of adding -single-branch. After that your command should work and git branch -a or git branch -r will show that branch. You should use fetch instead to update all remote tracking branches in your local repository with the brnaches from the remote. There may be a few more commands used, if necessary.) pull only fetches the to-be integrated remote branch. (Running git clone is shorthand, as it were, for doing a long sequence of Git commands that include git init, git remote add, git fetch, and git checkout. git checkout -b-B Specifying -b causes a new branch to be created as if git-branch(1) were called and then checked. Your Git copies some other Gits branch names to your own remote-tracking names, so that if they have master and develop, you wind up with origin/master and origin/develop, providing that you call the other Git origin.the default set of branch(es) or tag(s) to be obtained and updated and.However, you may fetch new data from the remote and then use git-checkout COMMITID to. When you make a shallow clone, Git adjusts two things: The short answer is: you cannot pull a specific commit from a remote. Or: git config '+refs/heads/*:refs/remotes/origin/*' +refs/heads/feature/my-feature:refs/remotes/origin/feature/myfeature
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |