首页 > 其他分享 >将git仓库从submodule转换为subtree

将git仓库从submodule转换为subtree

时间:2022-12-28 09:33:05浏览次数:34  
标签:git mpath -- subtree echo submodule

三个脚本

Alexander Mikhailian

cat .gitmodules |while read i
do
  if [[ $i == \[submodule* ]]; then
    mpath=$(echo $i | cut -d\" -f2)
    read i; read i;
    murl=$(echo $i|cut -d\  -f3)
    mcommit=`eval "git submodule status ${mpath} |cut -d\  -f2"`
    mname=$(basename $mpath)
    echo -e "$name\t$mpath\t$murl\t$mcommit"
    git submodule deinit $mpath
    git rm -r --cached $mpath
    rm -rf $mpath
    git remote add $mname $murl
    git fetch $mname
    git branch _$mname $mcommit
    git read-tree --prefix=$mpath/ -u _$mname
fi
done
git rm .gitmodules

标签:git,mpath,--,subtree,echo,submodule
From: https://www.cnblogs.com/east4ming/p/17009445.html

相关文章

  • 《HelloGitHub》第 81 期
    兴趣是最好的老师,HelloGitHub让你对编程感兴趣!简介HelloGitHub分享GitHub上有趣、入门级的开源项目。https://github.com/521xueweihan/HelloGitHub这里有实......
  • 为 Github 创造 Integration
    现在你可以从我们的集成件目录里面找到更多工具。这个目录目前有超过15个分类—从API管理到应用监控,Github的集成件可以支持您的开发周期的每一个阶段。......
  • 应用基础-在Hexo、Hugo博客框架中使用Gitalk基于Github上仓库项目的issue无后端服务评
    关注「WeiyiGeek」公众号本章目录:0x00Gitalk-基于Github的评论系统1.使用Gitalk进行Github的Oauth认证无法跨域获取Token问题解决办法1.快速介绍2.安装部署3.使用实践n.......
  • 关于git cherry-pick把一个分支的commit合并到另一个分支使用详解
    前言gitcherry-pick是本地分支间的commit相互给予,所以把远程分支拉到本地步骤1.将远程分支分别在本地对应创建比如develop和newpark-h5-view两个分支,要将develop的最......
  • git个人常用
    前言本篇是个人的git指令备忘录,会根据实际情况不断完善常用指令配置显示当前git配置gitconfig--list编辑git配置文件gitconfig-e[--global]设置提......
  • git 常用命令
    新建分支gitcheckout-bxxx切换分支gitcheckoutxxx查看分支//查看本地分支gitbranch//查看远程分支gitbranch-r//查看本地+远程gitbranch-a提交到......
  • 【Ubuntu搭建gitlab】gitlab搭建过程
    一、服务器硬件水平搭建gitlab服务器最低配置要求2核4G,低于这个配置的服务器运行效果很差二、安装依赖项sudoapt-getupdatesudoapt-getinstall-ycurlopenssh-s......
  • 从工具到实践:如何在GitHub上保障开源项目安全?
    1998年,ChristinePeterson创造了“开源软件”这个词。她解释道:“这是刻意为之,为了让其他人更容易理解这个领域”。同年,O’Reilly组织了首届“开源峰会”。开源软件受到更......
  • 从工具到实践:如何在GitHub上保障开源项目安全?
    1998年,ChristinePeterson创造了“开源软件”这个词。她解释道:“这是刻意为之,为了让其他人更容易理解这个领域”。同年,O’Reilly组织了首届“开源峰会”。开源软件受到更......
  • Golang 项目使用 Gitlab CI/CD 自动化持续集成
    GitlabCI/CD自动化持续集成该功能主要是代码提交到gitlab后,gitlab能按照指定的脚本,去运行诸如测试、构建、发布自动化,避免手工操作本文将演示以下集成项目: 测试(T......