Git checkout ๐ switch & restore
Git 2.23 ๋ถํฐ checkout์ ๊ธฐ๋ฅ์ด switch์ restore๋ก ๋ถ๋ฆฌ๋์๋ค.
- checkout : Switch branches or restore working tree files
- switch: Switch branches
- restore: Restore working tree files
switch
branch๋ฅผ ๋ณ๊ฒฝํ๋ค.
1
git switch develop
branch๋ฅผ ์์ฑํ๊ณ ํด๋น ๋ธ๋ฐ์น๋ก ๋ณ๊ฒฝํ๋ค.
1
git switch -c new-branch
restore
์์ ์ค์ธ ํ์ผ์ ๋ณต์ํ๋ค.
1
git restore hello.c
์์ธ์์ HEAD์ ๋ฒ์ ๊ณผ ์ผ์นํ๋๋ก ํ์ผ์ ๋ณต์ (git-reset[1]์ ์ฌ์ฉํ๋ ๊ฒ๊ณผ ๋์ผํจ)
1
git restore --staged hello.c
This post is licensed under CC BY 4.0 by the author.