Git ์ ๋ฆฌ
Git ๊ด๋ จ ํ๊ต ์์ ๋ ๋ฐฐ์ด ๋ด์ฉ ์ ๋ฆฌ
git init ๊ฒฝ๋ก๋ช : ์ผ๋ฐ ํด๋๋ฅผ git์ ์ฅ์๋ก ๋ณ๊ฒฝ / ๊ฒฝ๋ก๋ช ์๋ตํ ๊ฒฝ์ฐ ํ์ฌ ํด๋ ์ด๊ธฐํ
working directory : ๋ก์ปฌ ์ ์ฅ์์์ ์ค์ ํ์ผ ์์ฑ, ์์
git add ํ์ผ๋ช : untracked > tracked ํ์ผ ์ํ๋ก ๋ณ๊ฒฝ, stage๋ก ๊ฐ
git add . : ์ ์ฒด ํ์ผ ํด๋ ๋ฑ๋ก
.gitignore ํ์ผ์ ์ ์ฅ์ ํด๋์ ์ต์์ ๋๋ ํ ๋ฆฌ
git clone ์๊ฒฉ์ ์ฅ์URL ์ํด๋์ด๋ฆ : repository ๋ณต์ / ์ํด๋์ด๋ฆ ์๋ต > ํ์ฌ ํด๋
git rm --cached ํ์ผ๋ช : git๋ฑ๋ก๋ ํ์ผ ์ทจ์
git reset HEAD ํ์ผ๋ช : ํ๋ฒ์ด๋ผ๋ ์ปค๋ฐํ ๊ฒฝ์ฐ git ๋ฑ๋ก๋ ํ์ผ ์ทจ์
git mv ํ์ผ๋ช ์ํ์ผ๋ช : ํ์ผ ์ด๋ฆ ๋ณ๊ฒฝ
์ต์ด์ commit์๋ HEAD ํฌ์ธํฐ X
git commit -a : ์ปค๋ฐํ๊ธฐ ์ ๋ชจ๋ ํ์ผ add ํจ, ํ์ผ๋ฑ๋ก&์ปค๋ฐ ๋์์ ๊ฐ๋ฅ
git commit -m "๋ฉ์์ง" / ๋ฉ์์ง ๋ฃ๊ณ ์ถ์ง ์์ผ๋ฉด git commit --allow-empty-message -m ""
commit ํ๋ฉด stage์์ญ ์ด๊ธฐํ > working tree clean
git log : ์ปค๋ฐ ๋ชฉ๋ก ํ์ธ
git log ํ์ผ๋ช : ํน์ ํ์ผ ๋ก๊ทธ ํ์ธ
git checkout --ํ์ผ๋ช : ์์ ๋ ํ์ผ ๋๋๋ฆฌ๊ธฐ
git log --pretty=short : ์ปค๋ฐ ์์ฝ
git log --pretty=oneline : ์ปค๋ฐ ํ์ค๋ก ์ถ๋ ฅ
git diff : working directory๋ stage ๋น๊ต
git diff HEAD : stage์ ์ต์ commit(HEAD) ๋น๊ต
git remote add ๋ณ์นญ ์ฃผ์ : remote repository์ ์ฐ๊ฒฐ
git remote -v : remote repository ๋ณ์นญ, URL ํ์ธ
git remote rm ๋ณ์นญ : remote repository ์ฐ๊ฒฐ ๋์
git push ๋ณ์นญ branch์ด๋ฆ : remote repository์ ์ ๋ก๋
#์๋์ผ๋ก ๋ด๋ ค๋ฐ๊ธฐ
git clone remote์ ์ฅ์์ฃผ์ : ์ต์ด 1๋ฒ
git pull : ๊ฐฑ์ ๋ remote ์ ์ฅ์์ commit ์ ๋ณด ๋ค์ด๋ก๋
#์๋์ผ๋ก ๋ด๋ ค๋ฐ๊ธฐ
git fetch : ์ปค๋ฐ ๊ฐ์ ธ์์ง๋ง local์ ์ฅ์์๋ ์ด๋ค ์์ ๋ X
git merge ๋ณ์นญ/branch์ด๋ฆ
remote ์ ์ฅ์์ pushํ๋ ค๋ฉด local ์ ์ฅ์ ์ต์ ์ํ๋ก ์ ์งํด์ผํจ
branch : ์ ์ฅ๊ณต๊ฐ ํ๋์์ ๋ ๋ค๋ฅธ ์์ ๊ณต๊ฐ ๋ง๋ฆ, ๊ฐ์๊ณต๊ฐ ์ฌ์ฉ, ๊ธฐ์กดcommit๊ณผ ๋ถ๋ฆฌํด์ ๋ ๋ฆฝ์ ์ผ๋ก ๊ฐ๋ฐ ์์ ์ํ
์ถ๊ฐ branch ์์ฑ > ๊ธฐ์ค์ด ๋๋ branch/commit ํ๋ ์ด์ ํ์ํจ
git branch : branch ๋ชฉ๋ก ๋ณด๊ธฐ