如何在GitAction中获取子模块最新代码
如何在GitAction中获取子模块最新代码
JunpengzhouAlternatives
- You can use the
submodules
input to the checkout action:1
2
3
4
5steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive - another way, you can just run the command directly:
1
2
3
4
5steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive - or use git command with git-action plugin instead:
1
2
3
4
5
6
7steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout submodules
uses: srt32/git-actions@v0.0.3
with:
args: git submodule update --init --recursive
Git submodule 切换分支的代码
- 切换分支语法
1 | git config -f .gitmodules submodule.xxx.branch xxx1 |
- 示例
1 | git config -f .gitmodules submodule.themes/anzhiyu.branch dev |
将xxx
替换成对应的子模块名称(可在.gitmodules
文件中查看到),xxx1
替换成子模块需要的目标分支
原文链接:https://github.com/marketplace/actions/checkout-submodules
评论
隐私政策
✅ 你无需删除空行,直接评论以获取最佳展示效果