๐ก ๋ฒ์ ๊ด๋ฆฌ ์์คํ
์ ํ์์ฑ
- ๋ฒ์ ๊ด๋ฆฌ๊ฐ ๊ฐ๋ฅํ๋ค๋ฉด ์ฌ๋ฌ ์ฌ๋์ด ๊ฐ์ ํ์ผ๋ก ๋์์ ์์
ํ๊ฑฐ๋, ์ด์ ์ํ๋ก ๋๋๋ ค์ผ ํ๋ ๊ฒฝ์ฐ๊ฐ ์๊ฒผ์๋ ์์ฝ๊ฒ ์ด์ ์ํ๋ก ๋์๊ฐ๋ ๊ฒ์ด ๊ฐ๋ฅํ๋ค.
โ ๋ฒ์ ๊ด๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ์ด์
- ๋ฒ์ ๊ด๋ฆฌ๋ ๊ฐ ๋ฒ์ ๋ณ๋ก ๋ณ๊ฒฝ๋ ์ด๋ ฅ๋ค์ ์ ์ฅํ๋ ์์
์ ๋งํ๋ฉฐ, ํ์ผ์ด ๋ณ๊ฒฝ๋๋ฉด ๋ณ๊ฒฝ ์ด๋ ฅ ์ ์ฅ ๊ฐ๋ฅํ๋ค
- ์ด์ ๋ณ๊ฒฝ ์ด๋ ฅ๋ค์ด ๊ธฐ๋ก๋์ด ์์ผ๋ฏ๋ก, ์ด์ ๋ฒ์ ์ผ๋ก ๋๋์๊ฐ์ผ ํ๋ ์ํฉ์ด ๋ฐ์ํ๋ฉด ์์ฝ๊ฒ ๋์๊ฐ ์ ์๋ค.
- ๋๊ฐ ์ด๋ค ํ์ผ์ ์ถ๊ฐ, ์์ , ์ญ์ ํ๋์ง ํ์ผํ ์ ์์ผ๋ฉฐ, ์ด๋ค ๋ณ๊ฒฝ ์ฌํญ์ด ๋ฐ์ํ๋์ง ํ์
ํ๊ธฐ ์ฝ๋ค.
- ๋ฒ์ ๊ด๋ฆฌ ์์คํ
์ ํตํด ๊ด๋ฆฌ๋๋ ํ์ผ์ ๋ค์ํ ์๊ฒฉ ์ ์ฅ์๋ฅผ ์ด์ฉํ์ฌ ํ์
ํ๊ธฐ์ ์ข๋ค.
- ๋ฐฑ์
์ฉ ๋ชฉ์ ์ผ๋ก๋ ํ์ฉํ๊ธฐ ์ข๋ค.
๐ก Git
: ๊ฐ์ฅ ๊ฐ๋ ฅํ๊ณ ๋์ค์ ์ธ ๋ฒ์ ๊ด๋ฆฌ ์์คํ
- Git์ ๊ฐ๋ฐ์์ ์์ค ์ฝ๋ ๊ธฐ๋ก์ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๊ณ ์ถ์ ํ๊ธฐ ์ํด์ ๊ฐ๋ฐ๋ '๋ถ์ฐํ ๋ฒ์ ๊ด๋ฆฌ ์์คํ
'์ด๋ค.
- commit ๊ธฐ๋ฅ์ ํตํด ๋ณ๊ฒฝ์ฌํญ์ ๋ํ ์ค๋
์ท(commitํ ์์ ์ ์์ฑ๋ ๋ฐฑ์
๋ณต์ฌ๋ณธ)์ด ๋ง๋ค์ด์ง๊ณ ,
๋ ์ง๋ณ๋ก ์ด๋ค ํ์ผ์ด ์ด๋ป๊ฒ ๋ฐ๋์๋์ง ๋ณ๊ฒฝ์ฌํญ์ ํ์ด๋ผ์ดํธ๋ก ํ์ธ์ด ๊ฐ๋ฅํ๋ค.
๐ก Github
- Git Repository๋ฅผ ๊ด๋ฆฌํ ์ ์๋ ํด๋ผ์ฐ๋ ๊ธฐ๋ฐ ์๋น์ค
- Git์ผ๋ก ๋ฒ์ ์ ๊ด๋ฆฌํ๋ ํด๋์ ๋ํด์ Github๋ฅผ ํตํด ์ฌ๋ฌ ์ฌ๋๋ค์ด ๊ณต์ ํ๊ณ ์ ๊ทผ ๊ฐ๋ฅํ๋ค.
- Github์์ Code Review๋ฑ์ ํตํด ํ์
์ด ๊ฐ๋ฅํ๊ณ , ์๋ง์ ์คํ ์์ค ํ๋ก์ ํธ์ ๊ธฐ์ฌ๋ ๊ฐ๋ฅํ๋ค.
๐ก Git Repository
: ํ์ผ์ด๋ ํด๋๋ฅผ ์ ์ฅํด๋๋ ์ ์ฅ์
- Git์ผ๋ก ๊ด๋ฆฌ๋๋ ํด๋๋ฅผ Git repository๋ผ๊ณ ํ๋ค.
- Remote Repository์ Local Repository ๋ ์ข
๋ฅ์ ์ ์ฅ์๊ฐ ์๋ค.
Remote Repository
: ์๊ฒฉ ์จ๋ผ์ธ ์๋ฒ์์ ์ ์ฅ์, ์ฌ๋ฌ ์ฌ๋์ด ํจ๊ป ๊ณต์ ๊ฐ๋ฅํ๋ค.
Local Repository
: ๋ด ์ปดํจํฐ์ ์ ์ฅ์, ๋ด ๊ฐ์ธ ์ ์ฉ ์ ์ฅ์
- ์์
์ Local Repository์์ ๊ฐ๋ฅํ๋ฉฐ, ๋ด๊ฐ ์์
ํ ์ฝ๋๋ฅผ ๊ณต์ ํ๋ ค๋ฉด Remote Repository์ ์
๋ก๋ํด์ผํ๋ค.
- ๋ค๋ฅธ ์ฌ๋์ด Remote Repository์ ์ฌ๋ ค ๋์ ์์ค ์ฝ๋๋ฅผ ๋ด Local Repository๋ก ๊ฐ์ง๊ณ ์ฌ ์ ์๋ค.
- Working directory, Staging area(Index), HEAD๋ก ๊ตฌ์ฑ
๐ก Git ์ฉ์ด ๋ฐ ๋ช
๋ น์ด
Work space
- ํ์ฌ ์์
์ค์ธ Git ํ๋ก์ ํธ ํ์ผ๋ค์ด ์๋ ๋ด ์ปดํจํฐ ์์
๊ณต๊ฐ
Staging Area(Index)
- Work Space์์ ์์
์ ๋ค์ด๊ฐ ํ์ผ๋ค์ Git ๊ด๋ฆฌ ํ์ ์๋ ์ํ๋ก ๋ง๋ค์ด์ฃผ๋ ์์ญ
- Commit ์์ ์ธ ๋ณ๊ฒฝ ๋ด์ญ๋ค์ ๋๊ธฐ ์ฅ์
- 'git add' ๋ช
๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ Work Space์์์ ๋ณ๊ฒฝ ๋ด์ญ์ Staging Area์ ์ฌ๋ฆด ์ ์์ผ๋ฉฐ, ๋ช
๋ น์ด ์ต์
์ ํตํด ์ด ๋จ๊ณ๋ฅผ ์๋ตํ๋ ๊ฒ๋ ๊ฐ๋ฅ
HEAD
- ์ต์ข
ํ์ ๋ณธ(Commit)์ ์ ์ฅ
Fork
- Github์์ ๋ค๋ฅธ ์ฌ๋์ Remote Repository๋ฅผ ์์ ์ ๊ณ์ ์ Remote Repository๋ก ๋ณต์ฌํ๋ ๊ฒ
Clone
- Github๋ด์ ์๋ ์์ ์ ๊ณ์ ์ Remote Repository๋ฅผ ์์ ์ PC(Local Repository)๋ก ๋ค์ด๋ก๋ํ๋ ๊ฒ
Status
- Commit ํ๊ธฐ ์ ์ ๋จผ์ ์์ ์ Local Repository์ ๋ณ๊ฒฝ๋ ํ์ผ๋ค์ด ์ด๋ค ๊ฒ์ด ์๋์ง ํ์ธํ ๋ ์ฌ์ฉ
- 'git restore'๋ช
๋ น์ด ๋ค์ ํ์ผ๋ช
์
๋ ฅ
Add
- Untracked ๋ ํ์ผ๋ค์ Staging Area์ ์ถ๊ฐํ์ฌ Git ๊ด๋ฆฌ ํ์ ๋ ์ผ๋ก์จ, Commit ํ ์ ์๋ ์ํ๋ก ๋ง๋ค์ด ์ค๋ค.
- 'git add' ๋ช
๋ น์ด ๋ค์ ํ์ผ๋ช
์
๋ ฅ
- 'git add.' ๋ช
๋ น์ด๋ฅผ ์
๋ ฅํ๋ฉด Staging Area ์ unstaged ์ํ์ธ ๋ชจ๋ ํ์ผ์ ํ ๋ฒ์ ์ถ๊ฐ ๊ฐ๋ฅ
Commit
- ์์ ์์
์ด ๋๋ฌ์ ๋ ๋ณ๊ฒฝ์ฌํญ์ ์ ์ฅ
- '-m' ์ต์
์ ํตํด ์ฝ๋ฉํธ ์์ฑ ๊ฐ๋ฅํ๋ฉฐ, 'git commit -m' ๋ช
๋ น์ด ๋ค์ ์ปค๋ฐ ๋ฉ์ธ์ง๋ฅผ ๋ฐ์ดํ์์ ๋ฃ์ด ์์ฑ
- Commit ๊ธฐ๋ก์ ๋ ์ง, Commit ํ ์ฌ๋, Commit ๋ฉ์ธ์ง๊ฐ ๋ชจ๋ ๊ธฐ๋ก๋๋ค.
- 'git commit' ๋ช
๋ น์ด ์ฌ์ฉ
Reset
- Remote Repository ์๋ ์์ง ์
๋ก๋์ ์ด๊ณ , Local Reapository ์๋ง Commit ํ ๋ด์ฉ์ ์ทจ์ํ ๋ ์ฌ์ฉ
- 'git reset HEAD^' ๋ช
๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ฅ ์ต์ ์ Commit ์ ์ทจ์ํ ์ ์๋ค.
Log
- ํ์ฌ๊น์ง Commit ๋ ๋ด์ญ๋ค์ ํฐ๋ฏธ๋ ์ฐฝ์์ ํ์ธ ๊ฐ๋ฅ
- 'git log' ๋ช
๋ น์ด ์
๋ ฅ
- ํฐ๋ฏธ๋ ์ฐฝ์ ์ข
๋ฃํ๋ ๋ฐฉ๋ฒ์ 'q' ์
๋ ฅ
Push
- Local Repository ์์ ๋ณ๊ฒฝ ๋ฐ ๊ธฐ๋กํด๋์ Commit ๋ ์ฌํญ์ Remote Repository ๋ก ์
๋ก๋ํ๋ ๊ฒ
- 'git push' ๋ช
๋ น์ด ๋ค์ ๋ค๋ฅธ ๋ช
๋ น์ด๋ฅผ ์ํฉ์ ๋ฐ๋ผ ์
๋ ฅํ์ฌ ์ฌ์ฉ
Pull Request
- ๋ด๊ฐ ์ ์ํ ์ฝ๋ ๋ณ๊ฒฝ ์ฌํญ์ ๋ํด ๋ค๋ฅธ ์ฌ๋์๊ฒ ์๋ฆฌ๊ณ ๋ฐ์ ์ฌ๋ถ๋ฅผ ์์ฒญํ๋ ๊ฒ
Init
- ๊ธฐ์กด์ Work Space ์ ์๋ ๋๋ ํ ๋ฆฌ๋ฅผ ๋ฒ์ ๊ด๋ฆฌ๋ฅผ ์ํด Git Repository ๋ก ๋ณํํ ๋ ์ฌ์ฉ
- ์๋ก์ด Repository ๋ฅผ ์ด๊ธฐํ
- 'git init' ๋ช
๋ น์ด ์
๋ ฅ
Remote Add Origin
- ๋ณํํ Local Repository ๋ฅผ Github ์์ ์๊ฒฉ์ผ๋ก ๊ด๋ฆฌํ๊ธฐ ์ํด ๋์ Remote Repository ์ ์ฐ๊ฒฐํ ๋ ์ฌ์ฉ
- 'git remote add pair' ๋ช
๋ น์ด ๋ค์ Repository ์ฃผ์ ์
๋ ฅ
Remote Add Pair
- pair ์ Remote Repository ์ ์ฐ๊ฒฐ
- 'git remote add pair' ๋ช
๋ น์ด ๋ค์ Pair ์ Repository ์ฃผ์ ์
๋ ฅ
Remote -v
- ํ์ฌ์ Local Repository ์ ์ฐ๊ฒฐ๋ ๋ชจ๋ Remote repository ๋ชฉ๋ก ํ์ธ
- 'git remote -v' ๋ช
๋ น์ด ์
๋ ฅ