Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
git submodule && subtree
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Zhe Yu
April 01, 2014
Technology
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
git submodule && subtree
Zhe Yu
April 01, 2014
More Decks by Zhe Yu
See All by Zhe Yu
git submodule && git subtree
lazynight
0
300
Other Decks in Technology
See All in Technology
SREの視点で考えるSIEM活用術 〜AWS環境でのセキュリティ強化〜
cscengineer
PRO
0
170
Azure Serverless 2026:Production-ready な AI エージェント基盤 / Azure Serverless 2026: Production-Ready AI Agent Platform
miyake
2
500
え、こんなに早く改修できるの?──新人エンジニアとスクラムマスターの2人が語る、AI×アジャイル開発の現場
ysasago
2
640
The Knowledge Spine: A Machine-Executable Ontology for Governed Marketing Activation
vananth22
0
120
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
660
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
2.3k
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
150
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
4
3.5k
Cloudflare Workers 向けアプリを C# で構築する ~WASM Native AOT への道~
nenonaninu
1
940
[Kiro Meetup #7] Kiro Crew Dive Deep
konippi
0
130
aws-iot-platform-architecture-use-cases.pdf
ma2shita
0
500
Why Agent Cost Needs Observability
nttcom
0
120
Featured
See All Featured
Building an army of robots
kneath
307
46k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
710
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
240
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
830
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
530
Exploring anti-patterns in Rails
aemeredith
4
510
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
280
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
470
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
340
Transcript
Git Subtree解说 by于哲 2014.3.31
场景 对于⼀一些⽐比较⼤大的⼯工程,为了便于复⽤用,常常需要抽取⼦子 项⺫⽬目 A B C
⽅方案1:git submodule ! ⽅方案2:git subtree
git submodule submodule项⺫⽬目和它的⽗父项⺫⽬目本质上是2个独⽴立的git仓库, 只是⽗父项⺫⽬目存储了它依赖的submodule项⺫⽬目的版本号信息⽽而已。 坑: • git pull之后,需要 git submodule
update • detached HEAD state,需要 git checkout master • git clone 之后,需要 git submodule init & update • messy,etc
git subtree 简介: 替代git submodule 命令,合并⼦子仓库到项⺫⽬目中并放在⼦子 ⺫⽬目录,管理、更新都更加⽅方便。 要求: git version
> 1.8.0.0 if git version < 1.8.0.0: go https://github.com/apenwarr/git-subtree
why git subtree? • 管理和更新流程⽐比较⽅方便 • git v1.5.2以后建议使⽤用git subtree (git
v1.8.0.0 才合并进来) • 仓库 clone下来不需要 init 和 update • 不会产⽣生像.gitmodule类似的⽂文件 • git submodule 删除起来⽐比较费劲 • 另外还有⼀一些团队协作时的尴尬问题
如何使⽤用git subtree? 前期准备: ! 创建本地项⺫⽬目(两个项⺫⽬目,⼀一个库): git --git-dir=proj1.git init --bare git
--git-dir=proj2.git init —bare git --git-dir=lib1.git init —bare ! ! 填充数据,提交,etc
如何使⽤用git subtree? ! ! 1. git remote add -f <⼦子仓库名>
<⼦子仓库地址> ! 其中-f意思是在添加远程仓库之后,⽴立即执⾏行fetch ! 2. git subtree add --prefix=<⼦子⺫⽬目录名> <⼦子仓库名> <分⽀支> —squash ! —squash意思是把subtree的改动合并成⼀一次commit,这样就不⽤用拉取⼦子 项⺫⽬目完整的历史记录。 ! --prefix之后的=等号也可以⽤用空格。 ! ! 添加⼦子⺫⽬目录,建⽴立与git项⺫⽬目的关联
如何使⽤用git subtree? ! ! 1. git fetch <远程仓库名> <分⽀支> !
2. git subtree pull --prefix=<⼦子⺫⽬目录名> <远程分⽀支> <分 ⽀支> --squash ! ! ! 从远程仓库更新⼦子⺫⽬目录
如何使⽤用git subtree? ! ! 1. git subtree push --prefix=<⼦子⺫⽬目录名> <远程分⽀支名>
分⽀支 ! ! ! ! ! 从⼦子⺫⽬目录push到远程仓库
参考 • http://aoxuis.me/posts/2013/08/07/git-subtree/ • http://blogs.atlassian.com/2013/05/alternatives-to-git- submodule-git-subtree/
THANK YOU @jackyu