使用PyGit2仅克隆主分支

时间:2016-01-10 22:28:14

标签: python git libgit2 pygit2

我想克隆一些远程存储库,但只检索主分支。

我的代码目前获得了所有分支。

- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame
{
    if (newStatusBarFrame.size.height < 40) {
        for (UIView *view in self.window.subviews) {
            view.frame = self.window.bounds;
        }
    }
}

1 个答案:

答案 0 :(得分:0)

您的代码不只是获取所有分支,它反映了远程,还有远程跟踪分支,这可能会导致一些令人困惑的布局。

您已经设置了自己的refspec,因此您需要设置refspec以下载默认分支。如果您知道它,您可以更改代码以获得一个分支

remote = repo.remotes.create(name, url, "+refs/heads/master:refs/heads/master")