switch & restore
git 2.23 ๋ฒ์ ์ด ์ถ์๋๋ฉด์ ๋ง์ ๊ธฐ๋ฅ์ ์ํํ๋ checkout์ด switch์ restore๋ก ๋ถ๋ฆฌ๋๋ค.
๋ธ๋์น ์ ํ์ switch๋ก ํ๋ค.
$ git checkout <branch>
$ git switch <branch>
๋ธ๋์น ์์ฑ ๋ฐ ์ ํ์ --create ์ต์
์ ์ฝ์์ธ -c ์ต์
์ ์ฃผ๋ฉด๋๋ค.
$ git checkout -b <branch>
$ git switch -c <branch>
์ํน ๋๋ ํ ๋ฆฌ ๋ณต์์ restore๊ฐ ์ํํ๋ค. ์๋ฌด ์ต์
์ ์ฃผ์ง ์๊ฑฐ๋ --worktree ์ต์
์ ์ฃผ๋ฉด ๋๋ค.
$ git checkout -- <file>
$ git restore <file>
์คํ
์ด์ง๋ ํ์ผ์ ์ธ์คํ
์ด์งํ ๋๋ --staged ์ต์
์ ์ค๋ค.
$ git reset <file>
$ git restore --staged <file>
์ฐธ๊ณ ์๋ฃ
- โgit-switchโ, git-scm, 2019.
- โgit-restoreโ, git-scm, 2019.
- Taylor Blau, โHighlights from Git 2.23โ, The GitHub Blog, 2019.