
๐ฅ์ฃผ์๐ฅ
- ํด๋น ๋ช
๋ น์ด๋ฅผ ์คํํ๋ฉด ์ญ์ ๋ ํ์ผ๋ค์ ๋๋๋ฆด ์ ์์ต๋๋ค.
- ๊ทธ๋ฌ๋ ๋ช
๋ น์ด๋ฅผ ์ฌ์ฉํ์๊ธฐ ์ด์ ์ ํ๋ฒ ๋ ๊ณ ๋ฏผํด๋ณด๋ ๊ฒ์ ์ถ์ฒํฉ๋๋ค. :)
- ์กฐ๊ธ ๋ ์์ ํ git stash๋ฅผ ํ์ธํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
git clean์ด๋?
- ์์
ํ๊ณ ์๋ ํ์ผ์ Stash ํ์ง ์๊ณ ๋จ์ํ ๊ทธ ํ์ผ๋ค์ ์ญ์ ํ๊ณ ์ถ์ ๊ฒฝ์ฐ์ ์ฌ์ฉํ๋ ๋ช
๋ น์ด์
๋๋ค.
- ์ถ์ ๋๊ณ ์์ง ์๋(unstage)๊ฒฝ์ฐ์ ํ์ผ์ด ์ญ์ ๋๋ ๊ฒฝ์ฐ์
๋๋ค.

Example
- test.txt๋ผ๋ ํ์ผ์ ๋ง๋ค๊ณ
git init
์ผ๋ก ์ด๊ธฐํ๋ฅผ ํฉ๋๋ค.
- ๊ทธ๋ฆฌ๊ณ
git status
๋ก ์ํ๋ฅผ ๋ณธ๋ค๋ฉด ์๋์ ๊ฐ์ด ๊ฒฐ๊ณผ๊ฐ ๋์ต๋๋ค.

git clean์ผ๋ก ์ญ์ ๋ ๋์๋ค์ ๋ฏธ๋ฆฌ ํ์ธํ๋ ค๋ฉด?
$ git clean -d -n
test.txt
์ ์ถ์ ๋์ง ์๋ ํ์ผ์ด๊ธฐ ๋๋ฌธ์ ์ญ์ ๋ ์์ ์
๋๋ค.

๊ทธ๋ ๋ค๋ฉด git add test.txt
ํ์ฌ stage๋ก ์ฌ๋ฆฌ๊ฒ ๋๋ค๋ฉด?
test.txt
๋ ์ด์ stage๋ก ๋ณ๊ฒฝ๋์๊ธฐ ๋๋ฌธ์ ๋ ์ด์ ์ง์์ผํ ๋ชฉ๋ก์์ ์ ์ธ๋ฉ๋๋ค.

.gitignore๋ก ๋ฌด์๋๋ ํ์ผ๋ค๋ ์ง์ฐ๊ณ ์ถ๋ค๋ฉด?
$ git clean -d -x
Reference