递归地推送所有子模块 [英] Pushing all submodules recursively
本文介绍了递归地推送所有子模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了以下脚本来推送工作空间中的所有更改,包括子模块和超级项目.但是,听起来有点奇怪,我要做的就是这么复杂.有什么更好的方法,我想念吗?
I wrote the below script to push all the changes in the workspace, both in the submodules and the superproject. However, it sounds a little odd that, it is this complex to do what I want. Is there any better way, that I'm missing?
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
exit
fi
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${SCRIPT_DIR}/../submodule1"
git status
git add -A
git commit -m "$1"
git push origin master
cd "${SCRIPT_DIR}/../submodule2"
git status
git add -A
git commit -m "$1"
git push origin master
cd "${SCRIPT_DIR}/../submodule3"
git status
git add -A
git commit -m "$1"
git push origin master
printf "\n\nUpdating Super Project\n\n"
cd ..
git status
git add -A
git commit -m "All Submodules Updated - $1"
git push origin master
推荐答案
git1.7.11([ANNOUNCE] Git 1.7.11.rc1)提到:
git1.7.11 ([ANNOUNCE] Git 1.7.11.rc1) mentions:
"git push --recurse-submodules"学习了有选择地研究绑定到超级项目的子模块的历史并将其推入
"git push --recurse-submodules" learned to optionally look into the histories of submodules bound to the superproject and push them out.
因此您可以使用:
git push --recurse-submodules=on-demand
这篇关于递归地推送所有子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文