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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
oohira
January 21, 2020
Programming
0
130
git switch & git restore
oohira
January 21, 2020
Tweet
Share
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
110
Progressive OSS Contribution
oohira
1
150
Why Mob Programming?
oohira
3
2.3k
朝の15分読書会ふりかえり / 15min-reading-retrospective
oohira
0
170
朝の15分読書会のススメ
oohira
0
470
Ansibleで3台のビルドサーバーを3分で構築した話 / Set up build servers in 3 min by Ansible
oohira
0
230
知っておくと便利なcurl
oohira
0
240
git-svnで始めるボッチのためのGit
oohira
0
4.8k
Other Decks in Programming
See All in Programming
AtCoder Conference 2025
shindannin
0
1k
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
dchart: charts from deck markup
ajstarks
3
990
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
150
「ブロックテーマでは再現できない」は本当か?
inc2734
0
620
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
1.1k
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
250
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
ぼくの開発環境2026
yuzneri
0
110
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
Featured
See All Featured
The SEO Collaboration Effect
kristinabergwall1
0
350
Agile that works and the tools we love
rasmusluckow
331
21k
4 Signs Your Business is Dying
shpigford
187
22k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Facilitating Awesome Meetings
lara
57
6.7k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
The Limits of Empathy - UXLibs8
cassininazir
1
210
A Modern Web Designer's Workflow
chriscoyier
698
190k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
110
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
91
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
53
What does AI have to do with Human Rights?
axbom
PRO
0
2k
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 ࢀߟจݙ