如何添加 git 子模块并将其标记为发布?
How to add git submodule and tag it to a release?
git clone my-new-repo-url
mkdir deps
cd deps
git submodule add -b 6.2.0 https://github.com/leethomason/tinyxml2.git
产量
fatal: 'origin/6.2.0' is not a commit and a branch '6.2.0' cannot be created from it
Unable to checkout submodule 'deps/tinyxml2'
不填充 .gitmodules,但创建一个文件夹 .git/modules/deps/tinyxml2
并在 deps/tinyxml2
中添加一个 repo
我以为我以前这样做过,它会用
填充.gitmodules
[submodule "deps/tinyxml2"]
path = deps/tinyxml2
url = https://github.com/leethomason/tinyxml2.git
branch = 6.2.0
但它现在不工作怎么了?
分支和发布标签不是一回事。一个分支可能会随着时间的推移继续发展和变化。在 .gitmodules branch = something
中有标志意味着子模块将在被要求更新时跟踪该分支。
git submodule add https://github.com/leethomason/tinyxml2.git
用
填充 .gitmodules
[submodule "deps/tinyxml2"]
path = deps/tinyxml2
url = https://github.com/leethomason/tinyxml2.git
然后用
在子模块中手动签出所需的标签
cd deps/tinyxml2
git checkout 6.2.0
Add/commit/push 和
git commit -am "adding and commiting all in one command"
git push
将子模块添加到repo,在浏览器中我们可以看到
其中 c1424ee4
是生成发布标签的特定提交
现在正在将新克隆到另一个文件夹中
git clone my-new-repo-url
git submodule update --init --recursive
子模块是否已在同一版本标签 6.2.0 中检出(提交 c1424ee4
)
git clone my-new-repo-url
mkdir deps
cd deps
git submodule add -b 6.2.0 https://github.com/leethomason/tinyxml2.git
产量
fatal: 'origin/6.2.0' is not a commit and a branch '6.2.0' cannot be created from it
Unable to checkout submodule 'deps/tinyxml2'
不填充 .gitmodules,但创建一个文件夹 .git/modules/deps/tinyxml2
并在 deps/tinyxml2
我以为我以前这样做过,它会用
填充.gitmodules[submodule "deps/tinyxml2"]
path = deps/tinyxml2
url = https://github.com/leethomason/tinyxml2.git
branch = 6.2.0
但它现在不工作怎么了?
分支和发布标签不是一回事。一个分支可能会随着时间的推移继续发展和变化。在 .gitmodules branch = something
中有标志意味着子模块将在被要求更新时跟踪该分支。
git submodule add https://github.com/leethomason/tinyxml2.git
用
[submodule "deps/tinyxml2"]
path = deps/tinyxml2
url = https://github.com/leethomason/tinyxml2.git
然后用
在子模块中手动签出所需的标签cd deps/tinyxml2
git checkout 6.2.0
Add/commit/push 和
git commit -am "adding and commiting all in one command"
git push
将子模块添加到repo,在浏览器中我们可以看到
其中 c1424ee4
是生成发布标签的特定提交
现在正在将新克隆到另一个文件夹中
git clone my-new-repo-url
git submodule update --init --recursive
子模块是否已在同一版本标签 6.2.0 中检出(提交 c1424ee4
)