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 switch & git restore
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
oohira
January 21, 2020
Programming
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
git switch & git restore
oohira
January 21, 2020
More Decks by oohira
See All by oohira
私のエンジニア人生に影響を与えた技術書 / tech books that influenced my engineer life
oohira
1
300
コードレビューを通す技術 / technique to pass code review
oohira
1
130
Progressive OSS Contribution
oohira
1
180
Why Mob Programming?
oohira
3
2.5k
朝の15分読書会ふりかえり / 15min-reading-retrospective
oohira
0
180
朝の15分読書会のススメ
oohira
0
480
Ansibleで3台のビルドサーバーを3分で構築した話 / Set up build servers in 3 min by Ansible
oohira
0
250
知っておくと便利なcurl
oohira
0
270
git-svnで始めるボッチのためのGit
oohira
0
4.9k
Other Decks in Programming
See All in Programming
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
バグを直したら useEffect が消えた
colorful12
3
750
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
360
FastAPI の並行処理モデルを完全に理解する
hoto17296
8
3.1k
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
250
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
240
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
120
AIの中の人になってみる
htkym
0
130
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
740
Deep dive into the select statement (GopherCon UK)
jespino
0
150
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
130
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
230
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
290
Designing for Performance
lara
611
70k
How to Talk to Developers About Accessibility
jct
2
530
The untapped power of vector embeddings
frankvandijk
2
1.8k
How to Ace a Technical Interview
jacobian
281
24k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
420
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Being A Developer After 40
akosma
91
590k
Test your architecture with Archunit
thirion
2
2.4k
Faster Mobile Websites
deanohume
310
32k
Transcript
switch & restore ϏΞόογϡେฏ !PPIJSB
4VCKFDU<"//06/$&>(JUW 'SPN+VOJP$)BNBOPHJUTUFS!QPCPYDPN %BUF'SJ "VH 2 5XPOFXDPNNBOETHJUTXJUDIBOEHJUSFTUPSFBSFJOUSPEVDFEUP TQMJUDIFDLJOHPVUBCSBODIUPXPSLPOBEWBODJOHJUTIJTUPSZBOE DIFDLJOHPVUQBUITPVUPGUIFJOEFYBOEPSBUSFFJTIUPXPSLPO BEWBODJOHUIFDVSSFOUIJTUPSZPVUPGUIFTJOHMFHJUDIFDLPVU
DPNNBOE
• HJUTXJUDI • ϒϥϯνΛมߋ͢Δૢ࡞ • HJUSFTUPSF • ϑΝΠϧΛมߋ͢Δૢ࡞ ˞·ͩFYQFSJNFOUBMɻHJUDIFDLPVU͑Δ 3
HJUDIFDLPVU͕େ͖͍͔Βׂ
• ϒϥϯνͷΓସ͑ • ϒϥϯνͷ࡞ˍΓସ͑ • ͭલͷϒϥϯνʹΔ 4 HJUTXJUDI $ git
switch topic # git checkout topic $ git switch -c topic # git checkout -b topic $ git switch - # git checkout -
• ϑΝΠϧͷϩʔΧϧͷमਖ਼Λ͢ • ϑΝΠϧΛಛఆͷίϛοτʹ͢ 5 HJUSFTUPSF $ git restore
README # git checkout -- README $ git restore --source <commit> README # git checkout <commit> -- README
• εςʔδϯάΤϦΞʹ͋ΔϑΝΠϧΛ͢ • εςʔδϯάΤϦΞϩʔΧϧ͢ 6 HJUSFTUPSF $ git restore
--staged README # git reset README $ git restore --source HEAD --staged --worktree README # git reset --hard README
7 ઈରDPͷํ͕ଧ͍ͪ͢ $ vi ~/.gitconfig ... [alias] co = checkout
sw = switch
• )JHIMJHIUTGSPN(JU5IF(JU)VC#MPH • IUUQTHJUIVCCMPH IJHIMJHIUTGSPNHJU • (JUHJUTXJUDI%PDVNFOUBUJPO • IUUQTHJUTDNDPNEPDTHJUTXJUDI •
(JUHJUSFTUPSF%PDVNFOUBUJPO • IUUQTHJUTDNDPNEPDTHJUSFTUPSF 8 ࢀߟจݙ