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
0
89
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
270
コードレビューを通す技術 / technique to pass code review
oohira
1
78
Progressive OSS Contribution
oohira
1
140
Why Mob Programming?
oohira
3
2k
朝の15分読書会ふりかえり / 15min-reading-retrospective
oohira
0
140
朝の15分読書会のススメ
oohira
0
420
Ansibleで3台のビルドサーバーを3分で構築した話 / Set up build servers in 3 min by Ansible
oohira
0
160
知っておくと便利なcurl
oohira
0
180
git-svnで始めるボッチのためのGit
oohira
0
4.3k
Other Decks in Programming
See All in Programming
ドメイン駆動設計を実践するために必要なもの
bikisuke
4
330
[DroidKaigi 2024] Android ViewからJetpack Composeへ 〜Jetpack Compose移行のすゝめ〜 / From Android View to Jetpack Compose: A Guide to Migration
syarihu
1
650
実践!難読化ガイド
mitchan
0
210
Go1.23で入った errorsパッケージの小さなアプデ
kuro_kurorrr
2
390
【TID2024】模擬講義:プログラマと一緒にゲームをデザインしてみよう!
akatsukigames_tech
0
660
今インフラ技術をイチから学び直すなら
yuhta28
1
140
Jakarta EE meets AI
ivargrimstad
1
530
REXML改善のその後
naitoh
0
190
unique パッケージから学ぶ interning と weak reference @ Asakusa.go#3
karamaru
2
810
Jakarta EE meets AI
ivargrimstad
0
390
あなたのアプリ、ログはでてますか?あるいはログをだしてますか? (Funabashi.dev用 軽量版)
uzulla
2
120
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
290
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
27
7.4k
Side Projects
sachag
451
42k
GraphQLとの向き合い方2022年版
quramy
43
13k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.8k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
23
1.7k
Visualization
eitanlees
142
15k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
8.9k
Writing Fast Ruby
sferik
623
60k
A designer walks into a library…
pauljervisheath
201
24k
A better future with KSS
kneath
235
17k
The Cult of Friendly URLs
andyhume
76
6k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
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 ࢀߟจݙ