gpt4 book ai didi

git - 在 Android Studio 中访问 git 子模块

转载 作者:太空狗 更新时间:2023-10-29 13:22:02 72 4
gpt4 key购买 nike

我刚开始为自己的项目使用源代码管理,现在我想添加 Joda-Time。我想将它添加为子模块,所以我进入终端并执行:

git submodule add https://github.com/JodaOrg/joda-time.git

它成功下载了所有文件。然后我跑了:

git submodule init

什么也得不到。

git submodule status

返回

b9fe534c7f5876eced6494a6d6c1deaf2528a579 joda-time (v2.7-17-gb9fe534)

我检查了我的项目根目录,我看到了新的 joda-time 目录及其源代码。但是现在我如何访问我项目中的库?我错过了一步吗?

最佳答案

尝试使用 git submodule update --init。这将允许您一步完成 git submodule initgit submodule update。请注意,您只需添加一次 --init 选项。

引自doc :

update

Update the registered submodules to match what the superproject expects by cloning missing submodules and updating the working tree of the submodules.

另一方面,git init 本身很简单

copying submodule names and urls from [your] .gitmodules [file] to [your local] .git/config [folder].

完成此操作后,您会注意到您的子模块处于分离状态。您可以简单地从那里 check out 任何现有分支,例如,git checkout master check out 上游 master 分支。

关于git - 在 Android Studio 中访问 git 子模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29681116/

72 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com