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 九淺一深
Search
JohnsonLu
January 23, 2015
Education
410
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Git 九淺一深
我佛你第 1 次 讀書會簡報
JohnsonLu
January 23, 2015
Transcript
47 slides
Git 九淺⼀一深 JohnsonLu
• Introduction • Misuse • Commit Policy • Config •
Branch • Tips • Rebase & Cherry-pick • Sub Module • Hooks • Multiple Remote
Introduction
Local version control
Centralized version control
Distributed version control
None
The Three States
Misuse
–⾺馬雲 「版本控制不是複製整個資料夾。」
⼟土炮版本控制
None
–⾺馬國畢 「版本控制是要可以”控制”。」
None
None
–⾺馬英九 「版本控制的過程⼈人要看的懂。」
None
None
Commit Policy
• Separate subject from body with a blank line •
Limit the subject line to 50 characters • Capitalize the subject line • Do not end the subject line with a period • Use the imperative mood in the subject line • Wrap the body at 72 characters • Use the body to explain what and why vs. how
None
None
Config
• git config --global user.name “JohnsonLu" • git config --global
user.email
[email protected]
• git config --global core.editor vim • git config —list • git config --global push.default <matching or simple>
Branch
None
• git branch #列出⺫⽬目前有多少branch • git branch -a #列出所有branch •
git branch test-branch #產⽣生新的branch • git branch test-branch master #由master產⽣生新的branch • git branch -d test-branch #刪除branch • git branch -D test-branch #強制刪除branch • git checkout branch-name #切換到branch-name • git checkout master #切換到master • git checkout -b test-branch master #從master建⽴立新的branch,並同時切換過去 • git checkout <commit_hash> -b test #切換到某次commit並建⽴立新的branch
–⾺馬世莉 「如何拆解branch?」
Filter-Branch • git filter-branch --subdirectory-filter public -- --all
Tips
• add -p • reflog • stash • tag
• git tag -l #列出所有標籤 • git tag -a ver.1
-m "First Version” • git show <tag> • git tag -a <tag> <commit-hash> #針對特定 commit做tag • git push <origin> —tags #push 所有tag
Rebase & Cherry-pick
None
• 1.暫存⼀一份本機repository從上次pull之後再修改 的部份 • 2.將本機repository rollback到上⼀一次pull的狀況 • 3.套⽤用遠端的變更 • 4.套⽤用暫存下來的本地變更
• 1.git rebase <branch> • 2.當遇到檔案內容衝突時,修改並git add • 3.git rebase
--continue
cherry-pick
Sub Module
• git submodule add <origin> <dir_name> • git submodule init
#在.git/config 中加⼊入 submodule 設定 • git submodule update #把整個submodule clone 下來
Hooks
• .git/hooks
Multiple Remote
None
None
None
• git remote • git remote add [shortname] [url] •
git pull [shortname] [branch]
–⾺馬世莉 「Q & A」
More Decks by JohnsonLu
See All by JohnsonLu
觀落陰 AngularJS
johnson4932
2
140
Laravel 九淺一深
johnson4932
2
250
Other Decks in Education
See All in Education
1111
cbtlibrary
0
230
AIができることを人はなぜ学ぶのか ― 専門性を育て、AIと学び続ける大学へ
gmoriki
0
200
LP2627
cbtlibrary
0
230
Unit 4: Introduction to Software Development Life Cycle
sonakv
0
130
1007
cbtlibrary
0
290
Bilten 2025/26
radlovacki1976
0
250
Sekolah Sabat - Triwulan 4 2026 - Pelajaran 8
hiola
0
7.1k
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 NISO Training Series, Session Four: Copyright in Pop Culture and Digital Media"
baltimoreniso
0
250
Make-Time-Something-Kids-Can-See
onlinetimezone
0
140
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 NISO Training Series, Session Five: Open Movements & Author Rights"
baltimoreniso
0
250
Sanapilvet opetuksessa
matleenalaakso
1
36k
Unit 5: Valuation of Securities
bvr7352
0
400
Featured
See All Featured
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
990
Product Roadmaps are Hard
iamctodd
55
13k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
2
4.1k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
So, you think you're a good person
axbom
PRO
2
2.3k
Everyday Curiosity
cassininazir
0
430
How to Think Like a Performance Engineer
csswizardry
28
3k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Well, that’s weird…
csswizardry
3
270
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.7k