Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Git In A Tree
Search
Daniel Öberg
November 13, 2011
Programming
7
360
Git In A Tree
An illustrated guide to Git
Daniel Öberg
November 13, 2011
Tweet
Share
Other Decks in Programming
See All in Programming
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
120
Grafana:建立系統全知視角的捷徑
blueswen
0
270
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
180
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
3
700
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
450
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
510
Cell-Based Architecture
larchanjo
0
160
Graviton と Nitro と私
maroon1st
0
160
クラウドに依存しないS3を使った開発術
simesaba80
0
210
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
310
Developing static sites with Ruby
okuramasafumi
0
340
ELYZA_Findy AI Engineering Summit登壇資料_AIコーディング時代に「ちゃんと」やること_toB LLMプロダクト開発舞台裏_20251216
elyza
2
880
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
220
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
220
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
51k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
70
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
80
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
270
Discover your Explorer Soul
emna__ayadi
2
1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.5k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
110
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.8k
Transcript
Git Sitting In A Tree An illustrated guide to Git.
Nothingness git init
Nothingness echo “Duck” > README.txt README.txt
Tell git about our duck git add README.txt Staging Area
README.txt Duck
Save git commit -m “I wrote ‘Duck’ into README.txt” Staging
Area README.txt Duck Commit commit message
Save git commit -m “I wrote ‘Donald Duck’ into README.txt”
Staging Area README.txt Duck Commit Duck
Why not directly? README.txt Duck Commit Duck
Git hates us README.txt Duck Commit Duck
Git hates us Git has opinions
“If you deny the Index [staging area], you really deny
git itself.” - Linus Torvalds
Reason Splits your code into two sections: Code that has
been reviewed for a commit Code that hasn’t
Reason Splits your code into two sections: Code in the
staging area Code not in the staging area
Example I implemented both a new feature and a bug-fix
and forgot to commit them.
I’m happily coding echo "bug-fix" >> README.txt echo "new feature"
>> README.txt cat README.txt duck bug-fix new feature
Committing the feature only git add --patched README.txt && git
commit -m “Feature added” Staging Area README.txt new feature Commit Duck new feature new feature
Seeing what’s left git diff @@ -1,2 +1,3 @@ duck
+bug-fix new feature Really, really useful
Committing that git add README.txt && git commit -m “Bug
squashed” Staging Area README.txt bug-fix Commit Duck new feature bug-fix bug-fix
Send Specific Patch Now I can freely choose to send
a patch that contains only the bug-fix to my boss (he can have the new feature on his birthday). Duck new feature bug-fix
Remove Specific Patch ‘New feature’ might have contained a serious
bug. I can the remove the new feature without touching the bug-fix. Amazing, you say. Duck new feature bug-fix
Take A Sip Of Coffee
Again
Staging Area/Index We always commit by first adding or removing
files to the Index
git add Adds files content to the staging area. Staging
Area README.txt Duck
git add --patch Adds some part (it will ask you)
of the files to the staging area. Staging Area README.txt new feature
git rm Removes all the files content from the staging
area. Staging Area README.txt Duck
git diff Shows the difference between the staging area and
the working directory. Staging Area README.txt Diff
git commit -m “msg” Commit file content in staging area
with a description/message Staging Area README.txt Commit *
Good Work
Gotchas
git add Git has a list of files. By running
git add you also append the filenames given to this list. Nasty, nasty, nasty. Lots of confusion from this feature.
git commit -a This is the reason for tracking the
files. By adding an -a you tell git to add all its tracked files file contents to the staging area and then commit it all.
And A Lie
Staging Area What we call a staging area, Git officially
calls the Index.
Thanks for listening
United Lambdas Daniel Öberg
[email protected]