Unfortunately both options ( -depth and -single-branch) have been faulty in the past and the use of shallow clones implicits unresolved problems (as you can read in the link I posted above), which is caused by the given history-rewrite. Therefore a shallow clone ( with the depth-option) only fetches only one single branch (at your requested depth).
Now create a branch using the git checkout command: git checkout -b Branch Name 4. Copy the URL to the repo and go back to your local repo in GitKraken. You’ll need the URL for the new remote repo, so click the View on button. Uncheck the Clone after init option to only create the remote repo.
We walk through an example to help you reinforce your learning. git svn cloneIn this guide, we discuss how to clone a specific branch using Git using the git clone command. To clone only a specific branch, you must use the single-branch flag with the git commit command.
Branch name should be short and it should reflect the work we’re doing. By default, the git clone command duplicates all the branches from a Git repository. When creating a shallow clone with the -depth option, this is the default, unless -no-single-branch is given to fetch the histories near the tips of all branches." It’s good practice to create a new branch when working with repositories, whether it’s a small project or contributing to a groups work. "Clone only the history leading to the tip of a single branch, either specified by the -branch option or the primary branch remote's HEAD points at.
The full clone offers new (all) branches: florianb$ git branch -aĭue to the shallow-description in the technical documentation, a " git-clone -depth 20 repo result commit chains with a length of at most 20." A shallow clone therefore should contain the requested depth of commits, from the tip of a branch.Īs - in addition - the documentation of git clone for the -single-branch-option describes: The behavior is correct, after the last revision the master-branch is (since this is the primary remote's HEAD) the only remote-branch in the repository: florianb$ git branch -a Though I can try it on this machine again, but it would be better to know what's wrong.Īny suggestions or hints will be more than welcome.Įdit: Answer summary: Since git version 1.8.3.2 the "-depth" and "-no-single-branch" need to be used together to get the same behavior as before. Tried also cloning another repo, it works well. Tried the same command on another machine, it works well: $ git clone -depth 1 git:///pythonwebkit.git What could be the problem? How to debug it? In this snippet two of the remote branches are not shown: $ git clone -depth 1 git:///pythonwebkit.git After cloning a remote repository it does not show any remote branch by -a option.