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: Beyond the Basics
Search
John Bohn
July 10, 2012
Programming
4
190
Git: Beyond the Basics
John Bohn
July 10, 2012
Tweet
Share
More Decks by John Bohn
See All by John Bohn
SOLID Design Principles in Ruby
jjbohn
2
100
Other Decks in Programming
See All in Programming
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
190
GCCのプラグインを作る / I Made a GCC Plugin
shouth
1
160
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2k
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
170
C#/.NETのこれまでのふりかえり
tomokusaba
1
180
Hotwire or React? ~Reactの録画機能をHotwireに置き換えて得られた知見~ / hotwire_or_react
harunatsujita
8
5k
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
0
190
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
300
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
100
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
500
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1.1k
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
500
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Designing for humans not robots
tammielis
249
25k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Building Your Own Lightsaber
phodgson
102
6.1k
Visualization
eitanlees
145
15k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Side Projects
sachag
452
42k
Transcript
gitbeyond the basics Thursday, August 2, 12
John Bohn @jjbohn Thursday, August 2, 12
Developer at OpenSky curated social commerce Thursday, August 2, 12
git what is Thursday, August 2, 12
git is fast and lightweight free/open source distributed crazy simple
Thursday, August 2, 12
init branch add commit merge Thursday, August 2, 12
Almost any VCS works does this (more or less) What
is special about git? Thursday, August 2, 12
Interactivity Thursday, August 2, 12
git add --patch git add --interactive Thursday, August 2, 12
Arduino Example Thursday, August 2, 12
Change Blink Thursday, August 2, 12
Change Blink - Two logical changes - Don’t want to
bother undoing one - Can’t git add . or git add [file] Thursday, August 2, 12
git add --patch Thursday, August 2, 12
git add --patch Thursday, August 2, 12
git add --patch Thursday, August 2, 12
git add --patch Commit the change Thursday, August 2, 12
git add --patch Stage other changes Diff is now empty
(everything is staged or commited) Thursday, August 2, 12
git stash Thursday, August 2, 12
is super boring Thursday, August 2, 12
until you throw some flags at it... Thursday, August 2,
12
git stash --no-keep-index git stash --keep-index git stash --patch git
stash --include-untracked My Favorites Thursday, August 2, 12
Finding these commands is just a matter of digging Thursday,
August 2, 12
git anything --help Thursday, August 2, 12
git reset is not git revert Thursday, August 2, 12
git reset --soft [sha] git reset --hard [sha] git reset
--mixed [sha] Thursday, August 2, 12
You can also: git reset --patch (but not with those
modes) Thursday, August 2, 12
Bisecting aka: Finding a commit that screwed things up. Thursday,
August 2, 12
Bisecting Thursday, August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 6 Commits - One
Bug We know that 7b35b is good We know that cfc332 is bad But we have no idea where the bug was introduced cfc332 Thursday, August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 Tell git what is
known good and bad cfc332 good bad Thursday, August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 cfc332 good bad Thursday,
August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 cfc332 good bad good
Thursday, August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 cfc332 good bad good
good Thursday, August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 cfc332 good bad good
good 2ab1f is most likely good because the commit after it is Thursday, August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 cfc332 good bad good
good bad Thursday, August 2, 12
Bisecting 7b35b 91296 9680d 2ab1f c6d43 cfc332 good bad good
good bad bad Thursday, August 2, 12
Recovering lost commits Thursday, August 2, 12
git reflog Thursday, August 2, 12
git reflog Technically shows any action where the tip of
a branch is modified git reflog --all shows stashes, bisects, etc. Thursday, August 2, 12
Recovery Let’s say I reset --hard and wiped out the
commit that changed my LED to pin 10 Use combination of reflog and cherry-pick to get it back Thursday, August 2, 12
Recovery Found it! 3ecdba3 Thursday, August 2, 12
Recovery Double check that 3ecdba3 is really the commit we
want git diff 3ecdba3^.. 3ecdba3 Shows me the difference between the commit I want to cherry pick and the commit prior. Thursday, August 2, 12
git cherry-pick Now cherry pick 3ecdba3 into our working tree
Note: the sha has changed because this commit now has a different parent than it did when it was recorded into the reflog Thursday, August 2, 12
Recovery Checkout the reflog again to see the cherry-pick Thursday,
August 2, 12
Interactive Rebasing Changing the past one commit at a time
Thursday, August 2, 12
git rebase -i [commit] Thursday, August 2, 12
git rebase -i [commit] Thursday, August 2, 12
git rebase -i [commit] Thursday, August 2, 12
git rebase -i [commit] Thursday, August 2, 12
Interactive rebase Thursday, August 2, 12
git internals The plumbing and the porcelain Thursday, August 2,
12
git internals git stores snapshots, not differences Storing differences is
slow and inflexible CVS/Subversion git Thursday, August 2, 12
git internals git stores snapshots, not differences Storing differences is
slow and inflexible CVS/Subversion git Thursday, August 2, 12
git internals What does a commit look like? Thursday, August
2, 12
git internals Let’s investigate a repo Sorry for the bad
“investigation” image ;-) Thursday, August 2, 12
Thanks! Come work with me at OpenSky! We’re Hiring Thursday,
August 2, 12