use*_*584 28 git clone commit git-checkout
以下是我用于签出特定提交的命令.
git clone git://repo.git/repo123
git checkout <commitID>
Run Code Online (Sandbox Code Playgroud)
我想一步完成上述操作 - 仅使用git clone命令.
我想这样做的原因是,repo123非常庞大.检查我想要的提交将节省我很多时间.
我知道--depth选项.但在这种情况下,它是没有用的.谁能告诉我怎么做?
jth*_*ill 36
git clone u://r/l --branch x
Run Code Online (Sandbox Code Playgroud)
仍然克隆一切,但将本地HEAD设置为该分支,因此它是检出的.
您的问题是结帐太大还是存储库本身?作为git clone,那么,克隆一个仓库,你通常得到的全尺寸全库。(除非您按照您的建议进行浅层克隆。)
如果真的是关于错误分支的结帐,请git help clone说:
--no-checkout, -n
No checkout of HEAD is performed after the clone is complete.
Run Code Online (Sandbox Code Playgroud)
克隆后-n可以手动签出
我遇到了同样的情况,它与 Git Clone Command 和--depth. 并在命令末尾带-b参数指定branch-name/commit/Tag-Name。
句法:
git clone --depth 1 github.com:ORG-NAME/Repo.git -b <Branch-Name/Commit-Number/TAG>
Run Code Online (Sandbox Code Playgroud)