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
200
Porting to .NET Standard
alextercete
0
53
Prepping Commits
alextercete
1
120
The end of your line-endings nightmare
alextercete
0
170
I love sushi, therefore I love rebase
alextercete
0
99
ReadyRoll for DotNet developers
alextercete
0
84
Coding Dojo: The Randori Kata
alextercete
1
470
Other Decks in Programming
See All in Programming
Realtime API 入門
riofujimon
0
130
Outline View in SwiftUI
1024jp
1
260
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
120
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
420
gopls を改造したら開発生産性が高まった
satorunooshie
8
270
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
410
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.9k
ヤプリ新卒SREの オンボーディング
masaki12
0
100
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.4k
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
210
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
380
カスタムしながら理解するGraphQL Connection
yanagii
1
1.4k
Featured
See All Featured
Scaling GitHub
holman
458
140k
The Invisible Side of Design
smashingmag
297
50k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Designing Experiences People Love
moore
138
23k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
810
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Automating Front-end Workflow
addyosmani
1366
200k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
390
GitHub's CSS Performance
jonrohan
1030
460k
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