Android repo 命令和切换分支

发布于 2025-01-02 02:17:33 字数 460 浏览 2 评论 0原文

我觉得我对git已经有了很好的理解,但是当涉及到repo命令时,我就迷失了。我读过有关 repo 命令的内容,但我仍然不确定它如何将所有内容联系在一起。

我最大的问题是:

我可以将当​​前的分支从姜饼更改为 ICS 并可能返回吗?

我看到命令:

repo init -u https://android.googlesource.com/platform/manifest

根据我的理解,这将使用 master 分支创建一个存储库。如果我想指定分支,我可以这样做:

repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

我相信下载的大小约为 8GB,所以如果他们共享代码,我不想毁掉我的存储库。有没有办法在回购中切换分支?

I feel I have a pretty good understanding of git, but when it comes to the repo command, I get lost. I've read about the repo command, but I'm still not sure how it ties everything together.

My biggest question is:

Can I change my current branches from gingerbread to ICS and possibly back?

I see the command:

repo init -u https://android.googlesource.com/platform/manifest

From my understanding, this will create a repo with the master branch. If I want to specify the branch, I can do:

repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

The download is about 8GB, I believe, so I don't want to have to blow my repo away if they share code. is there a way to switch branches in repo?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦中的蝴蝶 2025-01-09 02:17:33

如果您使用不同的分支再次运行repo init -b OTHER_BRANCH,您只需reposync即可,它不会再次下载整个源代码。

请参阅repo help init 了解更多选项

If you run repo init -b OTHER_BRANCH a second time with a different branch, you can simply repo sync and it will not download the entire source code again.

See repo help init for more options

柳絮泡泡 2025-01-09 02:17:33

repo -b 参数指定应签出的 .repo/manifests git 存储库的分支。此存储库中的 default.xml 文件定义其他每个 git 存储库(项目)应位于哪个分支。

似乎回购协议的编写方式是这样的:如果您再次检查另一个清单分支是否同步回购协议,它将再次通过网络拉取所有代码。

您可以运行 repo forall -c 'git checkoutbranch_name' ,它将检出当前清单中声明的​​所有项目的指定分支,但如果在姜饼和 ics 之间添加/删除了项目(其中有是),那么您将无法获得这些项目的代码。

在 .repo/manifests 存储库中运行 git checkoutbranchname,然后运行 ​​reposync 可能会节省一些网络开销。

否则,由于 repo 的限制,唯一真正的方法是维护 aosp 的两个工作副本或准备重新同步。

The repo -b parameter specifies the branch of the .repo/manifests git repository that should be checked out. The default.xml file in this repository defines which branch each of the other git repositiories (projects) should be on.

It seems that repo is written in such a way that if you check out another manifest branch are repo sync again it will pull all the code again over the network.

You can run repo forall -c 'git checkout branch_name' which will checkout the specified branch for all projects that are declared in your current manifest but if there are projects added/removed between gingerbread and ics (which there are), then you won't get the code for these projects.

Running git checkout branchname in the .repo/manifests repository then running repo sync may enable you to save some network overhead.

Otherwise, due to the limitations of repo, the only real way to do it is to maintain two working copies of the aosp or be prepared to re-sync.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文