โถ Branch
git branch -d master : ๋ธ๋ฐ์น ์ญ์
git branch -M main : ๋ธ๋ฐ์น ์ด๋ฆ๋ณ๊ฒฝ1
git branch -m master newmaster : ๋ธ๋ฐ์น ์ด๋ฆ๋ณ๊ฒฝ2
git push -u origin master : ๊ฐ์ push
git remote update : ๋ธ๋ฐ์น ์
๋
git reset : git add ์ทจ์. unstage
โถ Stash
git stash : ์์
์์์ ์ฅ
git stash apply : ์์
๊ฐ์ ธ์ค๊ธฐ
git stash list
git stash drop : ์ต์ stash ์ญ์
git stash pop : ์์
๊ฐ์ ธ์จ ํ ์ญ์ . apply&drop
๊น ๋ธ๋์น (git branch) 6. stash
๋ง์ฝ ๋ธ๋์น์ ์์ ์ด ๋ค ๋๋์ง ์์๋๋ฐ, ๋ค๋ฅธ ๋ธ๋์น๋ก ๊ธํ ์ด๋(checkout) ํด์ผํ ๊ฒฝ์ฐ๋ ์ด๋ป๊ฒ ํด์ผ ํ ๊น? ์์ ์ ์๋ฃ(commit)ํ์ง ์์ผ๋ฉด ๋ค๋ฅธ ๋ธ๋์น๋ก ์ด๋(checkout)์ ํ ์ ์๋๋ฐ.... '์
psklog.tistory.com
โถ .git ํด๋ ์ค๋ณต
ํ์ํด๋์ .git ํด๋๊ฐ ์์ผ๋ฉด submodule๋ก ์ธ์ํจ -> ๋ณ๋์ git ์ ์ฅ์์ ์ฐ๋ํด์ผํจ -> ๋ชน์ ๊ท์ฐฎ์
1. ํ์ํด๋์ .gitํด๋ ์ญ์ -> git statusํ๋ฉด ํ์ํด๋ untracked๋ผ๊ณ ๋ธ
2. git rm --cached ํ์ํด๋
3. git add ํ์ํด๋
ํ์ .git ํด๋ ๋ชจ๋ ์ ๊ฑฐ - ์ ํ์ํค
๋ค์ ๋ฌธ์์ด ํฌํจ...
zetawiki.com
๋ staging Area์์๋ง ์ ๊ฑฐํ๊ณ ์ํน ๋๋ ํ ๋ฆฌ์ ์๋ ํ์ผ์ ์ง์ฐ์ง ์๊ณ ๋จ๊ฒจ๋ ์ ์๋ค. ๋ค์ ๋งํด ํ๋๋์คํฌ์ ์๋ ํ์ผ์ ๊ทธ๋๋ก ๋๊ณ Git๋ง ์ถ์ ํ์ง ์๊ฒ ํ๋ค. ์ด๊ฒ์ .gitignore ํ์ผ์ ์ถ๊ฐํ๋ ๊ฒ์ ๋นผ๋จน์๊ฑฐ๋, ๋์ฉ๋ ๋ก๊ทธ ํ์ผ์ด๋ ์ปดํ์ผ๋ ํ์ผ์ธ .a ํ์ผ๊ณผ ๊ฐ์ ๊ฒ์ ์ค์๋ก ์ถ๊ฐํ์ ๋ ์์ฃผ ์ ์ฉํ๋ค. --cached ์ต์ ์ ์ฌ์ฉํ์ฌ ๋ช ๋ น์ ์คํํ๋ค.
git rm --cached REAME
โถ .gitignore ์ฌ์ฉ
1. .gitignore์ vue.config.js ์ถ๊ฐ
2. git rm --cached vue.config.js --> ๊ทธ์ ์ผ git์ ์ ์ฉ๋จ
3. git commit -m "Ignore vue.config.js"
[Git] git ignore ํน์ ํ์ผ๋๋ ํด๋ ์ ์ธ or ๋ฌด์ํ๊ธฐ
Git์ ํ๊ฒ ๋๋ฉด ๋ด๊ฐ ์์ ํ๋ ๊ณต๊ฐ์๋ ํ์ํ์ง๋ง remote(์๊ฒฉ)์ push๋ฅผ ๋ฌด์ํด์ผ ํ๋ ๊ฒฝ์ฐ๊ฐ ์์ต๋๋ค. ์ด๋ฐ ๊ฒฝ์ฐ๋ ์์ค ํ์ผ์ด๋ผ๋๊ฐ ์ฌ๋ฆฌ๋ฉด ์ถฉ๋์ด ์ผ์ด๋ ์ค๋ฅ๋ฅผ ๋ฒํ ์
kcmschool.com