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
oohira
January 21, 2020
Programming
130
0
Share
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
120
Progressive OSS Contribution
oohira
1
160
Why Mob Programming?
oohira
3
2.4k
朝の15分読書会ふりかえり / 15min-reading-retrospective
oohira
0
180
朝の15分読書会のススメ
oohira
0
470
Ansibleで3台のビルドサーバーを3分で構築した話 / Set up build servers in 3 min by Ansible
oohira
0
240
知っておくと便利なcurl
oohira
0
260
git-svnで始めるボッチのためのGit
oohira
0
4.8k
Other Decks in Programming
See All in Programming
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
3
280
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
130
Coding as Prompting Since 2025
ragingwind
0
830
The Less-Told Story of Socket Timeouts
coe401_
3
120
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
480
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
23
13k
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
220
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
140
アクセシビリティ試験の"その後"を仕組み化する
yuuumiravy
0
150
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
1
180
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
550
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
Optimizing for Happiness
mojombo
378
71k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
53k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
330
エンジニアに許された特別な時間の終わり
watany
106
240k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
160
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
Leo the Paperboy
mayatellez
7
1.7k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Claude Code のすすめ
schroneko
67
220k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
99
Navigating Team Friction
lara
192
16k
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 ࢀߟจݙ