3

Google のgit-repoプラグインを使用しています。私の理解によるとrepo sync、リポジトリからソース コード全体 (つまり、以前のリビジョン) をダウンロードします。そのため、このプロセス全体を完了するのに多くの時間がかかっています。

リポジトリから最新のコミットのみをダウンロードできますか?

4

3 に答える 3

5

I don't use repo, but it appears that you can pass the --depth flag to repo init. Using something like repo init -u URL --depth=1. The depth flag gets passed to git-clone and create a repo with only part of the history:

--depth <depth>

Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.

于 2013-08-10T16:26:08.043 に答える
2

はい、デフォルトでgit fetch(これは機能の一部ですgit clone)、リモート リポジトリの完全な履歴を取得します。

fetch コマンドのオプションを使用して、取得する履歴の量を制限できます--depth (clone はそれを fetch に渡します)。使用できる最小限の履歴を取得するには、次のようにします。

git clone --depth 1 REPO_URL

これにより、最新のコミットとその直前のコミットが取得されますが、古いコミットは取得されません。深さが 0 の場合は完全な履歴が必要と見なされるため、最新のコミットだけを取得することはできません。しかし、これは近いです。

後でgit fetch、使用可能な履歴の量を増やすために、より大きな深さで使用したりgit fetch --unshallow、完全な履歴を取得するために使用したりできます。

現在、浅いリポジトリには多くの制限があります。言うための ドキュメントgit clone --depth

浅いリポジトリには多くの制限があります (クローンやフェッチ、プッシュはできません) が、長い歴史を持つ大規模なプロジェクトの最近の履歴にのみ関心があり、そうしたい場合には十分です。パッチとして修正を送信します。

最近、これらの制限を減らしたり、削除したりする作業が行われています。

于 2013-08-10T14:23:28.600 に答える
0

あなたが探しているのはおそらくgit pull See the docsです。まず、github リポジトリをリモート ホストとして追加する必要があります。

git remote add master git@github.com:username/repository.git

その後、リポジトリからプルできます。github には、コミットを.zipファイルとしてダウンロードするためのリンクもあります。通常、その形式は次のとおりです。

https://github.com/username/repository/archive/master.zip
于 2013-08-10T12:48:12.133 に答える