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
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
760
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
useSyncExternalStoreを使いまくる
ssssota
6
1k
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
140
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
Go の GC の不得意な部分を克服したい
taiyow
3
780
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
2
220
命名をリントする
chiroruxx
1
400
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
Recoilを剥がしている話
kirik
5
6.7k
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
It's Worth the Effort
3n
183
28k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
The Cult of Friendly URLs
andyhume
78
6.1k
Bash Introduction
62gerente
608
210k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Speed Design
sergeychernyshev
25
670
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