Upgrade to Pro — share decks privately, control downloads, hide ads and more …

git switch & git restore

oohira
January 21, 2020

git switch & git restore

oohira

January 21, 2020
Tweet

More Decks by oohira

Other Decks in Programming

Transcript

  1. • ϒϥϯνͷ੾Γସ͑ • ϒϥϯνͷ࡞੒ˍ੾Γସ͑ • ͭલͷϒϥϯνʹ໭Δ 4 HJUTXJUDI $ git

    switch topic # git checkout topic $ git switch -c topic # git checkout -b topic $ git switch - # git checkout -
  2. • ϑΝΠϧͷϩʔΧϧͷमਖ਼Λ໭͢ • ϑΝΠϧΛಛఆͷίϛοτʹ໭͢ 5 HJUSFTUPSF  $ git restore

    README # git checkout -- README $ git restore --source <commit> README # git checkout <commit> -- README
  3. • εςʔδϯάΤϦΞʹ͋ΔϑΝΠϧΛ໭͢ • εςʔδϯάΤϦΞ΋ϩʔΧϧ΋໭͢ 6 HJUSFTUPSF  $ git restore

    --staged README # git reset README $ git restore --source HEAD --staged --worktree README # git reset --hard README