submodule切换分支_添加Git子模块时,如何指定分支/标记?

请注意如果你有现有子模不是跟踪一个分支然后.如果你有git 1.8.2+):确保父回购知道它的子模块现在跟踪一个分支:cd /path/to/your/parent/repo

git config -f .gitmodules submodule..branch 

确保您的子模块实际上是该分支的最迟部分:cd path/to/your/submodule

git checkout -b branch --track origin/branch

# if the master branch already exist:

git branch -u origin/master master

(以“原产地”为子模块已经从。

A git remote -v在该子模块中将显示它。通常,它是“起源”)不要忘记在父回购中记录子模块的新状态:cd /path/to/your/parent/repo

git add path/to/your/submodule

git commit -m "Make submodule tracking a branch"

子模块的后续更新必须使用--remote备选方案:# update your submodule

# --remote will also fetch and ensure that

# the latest commit from the branch is used

git submodule update --remote

# to avoid fetching use

git submodule update --remote --no-fetch

请注意,与GIT 2.10+(2016年第三季度),你可以用‘.‘作为一个分支名称:

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值