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
53
Prepping Commits
alextercete
1
120
The end of your line-endings nightmare
alextercete
0
180
I love sushi, therefore I love rebase
alextercete
0
99
ReadyRoll for DotNet developers
alextercete
0
85
Coding Dojo: The Randori Kata
alextercete
1
470
Other Decks in Programming
See All in Programming
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
740
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
460
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
talk-with-local-llm-with-web-streams-api
kbaba1001
0
180
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
快速入門可觀測性
blueswen
0
350
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Language of Interfaces
destraynor
154
24k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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