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
Commandless Git
Search
Alex Tercete
April 07, 2015
Programming
1
210
Commandless Git
Having a basic understanding of how Git works is the key to taking the most out of it.
Alex Tercete
April 07, 2015
Tweet
Share
More Decks by Alex Tercete
See All by Alex Tercete
Making Makefiles
alextercete
0
64
Shipping containers
alextercete
0
52
Parallelism and Symmetry
alextercete
0
210
Porting to .NET Standard
alextercete
0
55
Prepping Commits
alextercete
1
130
The end of your line-endings nightmare
alextercete
0
180
I love sushi, therefore I love rebase
alextercete
0
100
ReadyRoll for DotNet developers
alextercete
0
85
Coding Dojo: The Randori Kata
alextercete
1
500
Other Decks in Programming
See All in Programming
CSS Linter による Baseline サポートの仕組み
ryo_manba
1
140
技術を改善し続ける
gumioji
0
110
ML.NETで始める機械学習
ymd65536
0
220
密集、ドキュメントのコロケーション with AWS Lambda
satoshi256kbyte
1
210
仕様変更に耐えるための"今の"DRY原則を考える
mkmk884
9
2.9k
新宿駅構内を三人称視点で探索してみる
satoshi7190
2
110
Visual StudioのGitHub Copilotでいろいろやってみる
tomokusaba
1
200
プログラミング言語学習のススメ / why-do-i-learn-programming-language
yashi8484
0
150
Bedrock Agentsレスポンス解析によるAgentのOps
licux
3
900
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
380
Django NinjaによるAPI開発の効率化とリプレースの実践
kashewnuts
1
200
SwiftUI Viewの責務分離
elmetal
PRO
2
260
Featured
See All Featured
A Tale of Four Properties
chriscoyier
158
23k
Agile that works and the tools we love
rasmusluckow
328
21k
Navigating Team Friction
lara
183
15k
Documentation Writing (for coders)
carmenintech
67
4.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
A Philosophy of Restraint
colly
203
16k
Raft: Consensus for Rubyists
vanstee
137
6.8k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
For a Future-Friendly Web
brad_frost
176
9.6k
Faster Mobile Websites
deanohume
306
31k
Designing Experiences People Love
moore
140
23k
Mobile First: as difficult as doing things right
swwweet
223
9.4k
Transcript
Commandless Git https://www.flickr.com/photos/sfxeric/4578550858
Alex Tercete @alextercete Rio de Janeiro, Brazil EnergyHelpline
https://www.flickr.com/photos/cdevers/3292421477
https://www.flickr.com/photos/cdevers/4618787095
https://www.flickr.com/photos/cdevers/4618786545
Simplified Model
Engine Fuel Transmission Wheels Brakes Steering
Engine Fuel Transmission Wheels Brakes Steering
Engine Fuel Transmission Wheels Brakes Steering
Engine Fuel Transmission Wheels Brakes Steering
Brakes Engine Fuel Transmission Wheels Steering
Makes things intuitive
Brakes Engine Fuel Transmission Wheels Steering Brake
Brakes Engine Fuel Transmission Wheels Steering
Brakes Engine Fuel Transmission Wheels Steering
It works, but not as it was meant to
Brakes Engine Fuel Transmission Wheels Steering
Brakes Engine Fuel Transmission Wheels Steering
None
Working directory Staging area path/to/A.txt path/to/B.txt Files database Add
Working directory Staging area path/to/A.txt path/to/B.txt Files database
Working directory Staging area path/to/A.txt path/to/B.txt Files database Hash generation
SHA1 c3
Working directory Staging area path/to/A.txt path/to/B.txt Files database Hash generation
c3 SHA1
Working directory Staging area path/to/A.txt path/to/B.txt Files database c3
Working directory Staging area path/to/A.txt path/to/B.txt Files database c3
Working directory Staging area path/to/A.txt c3 path/to/A.txt path/to/B.txt Files database
c3
Working directory Staging area path/to/A.txt c3 path/to/A.txt path/to/B.txt Files database
c3 Hash generation SHA1 ed
Working directory Staging area path/to/A.txt c3 path/to/A.txt path/to/B.txt Files database
c3 Hash generation SHA1 ed ed
c3 ed Files database Working directory Staging area path/to/A.txt c3
path/to/A.txt path/to/B.txt
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
c3 ed path/to/A.txt path/to/B.txt
– Hash is generated for the file’s content – Generated
hash is the same for identical inputs – Files are saved to the files database – Changes are added to the staging area Add
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
c3 ed path/to/A.txt path/to/B.txt Commit
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
c3 ed path/to/A.txt path/to/B.txt
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
c3 ed path/to/A.txt path/to/B.txt Hash generation SHA1 ca c3 ed
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
c3 ed path/to/A.txt path/to/B.txt Hash generation SHA1 ca c3 ed path/to/A.txt path/to/B.txt c3 ed Commit ca
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
path/to/A.txt path/to/B.txt c3 ed Commit ca
c3 ed Files database Working directory Staging area Commit ca
path/to/A.txt path/to/B.txt path/to/A.txt path/to/B.txt c3 ed Commits tree ca
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt
c3 ed Files database Working directory Staging area path/to/A.txt Commits
tree ca path/to/B.txt other/path/to/C.txt
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt path/to/B.txt other/path/to/C.txt 17 2b 17 2b
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt path/to/B.txt other/path/to/C.txt 17 2b 17 2b Hash generation SHA1 c3 17 7b 2b ca path/to/A.txt path/to/B.txt c3 17 Commit 7b other/path/to/C.txt 2b
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt 17 2b path/to/A.txt path/to/B.txt c3 17 Commit 7b other/path/to/C.txt 2b 7b
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt 17 2b 7b
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt 17 2b 7b
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt 17 2b 7b other/path/to/C.txt 6d 6d
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt 17 2b 7b other/path/to/C.txt 6d 6d Hash generation SHA1 c3 17 6d path/to/A.txt path/to/B.txt c3 17 Commit 33 other/path/to/C.txt 6d 33 7b
c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt
Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33
– Hash is generated combining • Hash of the parent
commit • Hashes of the files in the commit – Points to every file tracked by the repository – Staging area is cleared after the commit – Gets added to the commits tree Commit
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 Branch
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33 8e
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33 8e 4c
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c ff
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c ff 54
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54
– HEAD indicates the current commit being pointed to –
There is nothing special about master – When on a branch, the reference gets updated after a commit Branch
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54 Checkout
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD ca master 33 feature/something 54 8e 4c ff 54
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD ca master 33 feature/something 54 8e 4c ff 54
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca 17 2b 7b 6d 33 References HEAD ca master 33 feature/something 54 8e 4c ff 54
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54
c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree
ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54
– Only HEAD moves – Files are copied from the
files database into the working directory – Files database remains unaltered – Commits tree remains unaltered Checkout
Files database Commits tree ca 7b 33 References HEAD 54
master 33 feature/something 54 4c 54 c3 ed 17 2b 6d 8e ff Merge
Files database Commits tree ca 7b 33 References HEAD 54
master 33 feature/something 54 4c 54 c3 ed 17 2b 6d 8e ff
Files database Commits tree ca 7b 33 References HEAD 33
master 33 feature/something 54 4c 54 c3 ed 17 2b 6d 8e ff
Files database Commits tree ca 7b 33 References HEAD e6
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98
Files database Commits tree ca 7b 33 References HEAD e6
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Merge NO CONFLICTS
Files database Commits tree ca 7b 33 References HEAD e6
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98
Files database Commits tree ca 7b 33 References HEAD 2f
master 2f feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 2f
Files database Commits tree ca 7b 33 References HEAD e6
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Merge WITH CONFLICTS
Files database Commits tree ca 7b 33 References HEAD e6
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98
Files database Commits tree ca 7b 33 References HEAD b5
master b5 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 57 b5
– Brings changes from other branch into current branch –
Conflict resolution is done once – Commit has two parents Merge
Files database Commits tree ca 7b 33 References HEAD e6
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Rebase NO CONFLICTS
Files database Commits tree ca 7b 33 References HEAD e6
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98
Files database Commits tree ca 7b 33 References HEAD 54
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98
Files database Commits tree ca 7b 33 References HEAD a2
master e6 feature/something 54 a2 e6 c3 ed 17 2b 6d 8e ff 98 4c 54
Files database Commits tree ca 7b 33 References HEAD 9f
master e6 feature/something 54 a2 e6 c3 ed 17 2b 6d 8e ff 98 4c 9f 54
Files database Commits tree ca 7b 33 References HEAD 9f
master e6 feature/something 9f a2 e6 c3 ed 17 2b 6d 8e ff 98 4c 9f 54
Files database Commits tree ca 7b 33 References HEAD 54
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Rebase WITH CONFLICTS
Files database Commits tree ca 7b 33 References HEAD 54
master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98
Files database Commits tree ca 7b 33 References HEAD dd
master e6 feature/something 54 dd e6 c3 ed 17 2b 6d 8e ff 98 4c 54 7f
Files database Commits tree ca 7b 33 References HEAD b8
master e6 feature/something 54 dd e6 c3 ed 17 2b 6d 8e ff 98 4c 54 7f b8
Files database Commits tree ca 7b 33 References HEAD b8
master e6 feature/something b8 dd e6 c3 ed 17 2b 6d 8e ff 98 4c 54 7f b8
– Puts changes introduced by current branch onto other branch
– Conflict resolution is done for each commit – No extra commits are made Rebase
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Push
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33
– There is nothing special about origin – Tracking branch
gets updated before uploading data to the remote – The remote is just another repository Push
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 Fetch
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa 0e fa
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa 0e fa 62 b0
Files database Commits tree ca 7b 33 References HEAD 33
master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master b0 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa 0e fa 62 b0
– Tracking branch gets updated after downloading data from the
remote – Merge or rebase can be performed afterwards Fetch
https://www.flickr.com/photos/inthe-arena/15501000164
Reset Stash Revert
http://git-scm.com/book
Alex Tercete @alextercete speakerdeck.com/alextercete/commandless-git
Thank you! https://www.flickr.com/photos/sfxeric/4578550858