Git 101
what is Git ?
Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
Ref) wiki

Before getting start
You need a Github account
Github
GitHub, Inc. is an American multinational corporation that provides hosting for software development and version control using Git.
Ref) wiki
์ฝ๊ฒ ๋งํด์, Git ์ ๋ฒ์ ๊ด๋ฆฌ "์์คํ " ์ด๊ณ , github ์ Git ์์คํ ์ ์ ๊ณตํ๋ ํ์ฌ
if you use Window OS, I recommand you Gitbash.
Gitbash
์๋์ฐ์์ bash ๋ฅผ ์ฌ์ฉํ๊ฒ ํด์ค
Powershell ์ปค๋งจ๋์ฐฝ์์๋ git ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ ์ ์์ง๋ง, ๊ตณ์ด git ์์ ์๋์ฐ๋ฅผ ์ํด ๋ง๋ git bash ๋ฅผ ์ ์ฐ๊ณ Powershell ์ ์ฌ์ฉํ ์ด์ ๊ฐ ์์
you can download at here
!! ๊น๋ฐฐ์ฌ ์ค์นํ ๋ ์ฐํด๋ฆญ์ผ๋ก ๊น๋ฐฐ์ฌ ์ฌ๋ ์ ํ์ฌํญ์ด ์๋๋ฐ ์ด๊ฑฐ ๊ผญ ํด์ฃผ๊ธธ ๊ถ์ฅํ๋ค.
Making repository
github ์์ ์์ ์ pjt ๋ค์ repository ๋ณ๋ก ๊ด๋ฆฌํ๋ค.
๋ณดํต ๋ก์ปฌ์์ pjt ์ต์์ ๋๋ ํ ๋ฆฌ๋ฅผ github ์ ์ฐ๊ฒฐํด์ ( init ) ๋๋ ํ ๋ฆฌ๋ฅผ github ์ repository ๋ก ๋์ฐ๋ ๋ฐฉ์์ด์ง๋ง, ๋ github ํ์ด์ง์์ repo ๋ฅผ ๋ง๋ค๊ณ ๋ก์ปฌ๋ก ํด๋ก ํด์ ๋ด ์ฝ๋๋ฅผ ๋ก์ปฌ์ ํด๋ก ๋ repo ๋๋ ํ ๋ฆฌ์ ๋ณต๋ถํ๊ณ push ํ๋ ๋ฐฉ์์ ์ ํธํ๋ค.
์ด์ : ๊ฐ๋จํ๊ณ ์ค๋ฅ๋ ์ผ์ด ์์
1. github ์์ repo ๋ง๋ค๊ธฐ

Repositories ํญ์ ๋ค์ด๊ฐ๋ฉด ์ฐ์ธก์ New ๋ฒํผ์ ๋๋ฅธ๋ค.
pjt ์ ์ด๋ฆ์ repo ์ด๋ฆ์ผ๋ก ์ ํ๊ณ Add a README ์ ์ฒดํฌํ๋๊ฑธ ๊ถ์ฅํ๋ค.
README.md ํ์ผ์ ์ต์๋จ ๋๋ ํ ๋ฆฌ์์ ํ๋ก์ ํธ์ ๋ํ ์ค๋ช ์ ๋ด๋นํ๋ค.
๊ทธ๋ฆฌ๊ณ ๊นํ์์ default branch ๊ฐ ์ธ์ ๊ฐ master ๋ง๊ณ ๋ญ ๋ค๋ฅธ๊ฑธ๋ก ๋์ด์์๋๋ฐ ๋๋ถ๋ถ ๊ฐ๋ฐ์๊ฐ master ๋ธ๋์น๋ฅผ ์ฌ์ฉํ๋ฏ๋ก ์ ๋ ๊ฒ ํด์ฃผ๋๊ฑธ ๊ถ์ฅํจ

๋ง๋ค๊ณ repo ์ ๋ค์ด๊ฐ๋ฉด ์ฐ์ธก์ ์ฝ๋๋ฅผ ๋๋ฅด๋ฉด repo ๋ฅผ clone ํ ์ ์๋ ๊ฒฝ๋ก๋ฅผ ๋ณต์ฌํ ์ ์๋ค.

์ด์ ๋ก์ปฌ๋ก ๋์์์ ๋ด๊ฐ ์ด repo ๋ฅผ clone ์ถ์ ์์น์์ ํฐ๋ฏธ๋์ ์ด์ด์ค๋ค. ( window ๋ ํด๋น ์์น์์ ์ฐํด๋ฆญ์ผ๋ก ๊น๋ฐฐ์ฌ ์ด์ด์ ) ์๋ ๋ช ๋ น์ด๋ฅผ ์ ๋ ฅํ๊ณ ๊ฒฝ๋ก๋ฅผ ๋ณต์ฌํ๋ค.
git clone [๊ฒฝ๋ก]
2. Push ํ๊ธฐ
์ง๊ธ๋ถํฐ ์์๋ฅผ ์ ๊ธฐ์ตํด์ผํจ
git add .
git commit -m '[์ฐ๊ณ ์ถ์ ๋ง]'
git push # ์๋๋ฉด git push origin master # origin ์ ์ด๋ค ๋ธ๋์น์ ํธ์ฌํ ๊ฒ์ธ์ง์ ๋ํ ์ต์ ์ธ๋ฐ, default ๋ก ํ์ฌ ๋ธ๋์น ( ๋ณ๊ฒฝํ์ง ์์ ์ด์ master ) ์ด๋ ๊ทธ๋ฅ ํด๋ ๋จ # ๋ธ๋์น์ ๋ํด์๋ ๋ค์์ ์ ๋ฆฌ
์ ์ธ ๊ฐ์ง ๋ช ๋ น์ด๋ฅผ ์ํํ๋ฉด ๋ก์ปฌ์ ๋ด์ฉ์ด github ์ repo ๋ก push ๋๋ ๊ฒ
3. pull ํ๊ธฐ
์ด๊ฑด ๋ญ๋๋ฉด ์ฌ๋ฌ ๋ก์ปฌ์์ ์์ ์ ํ ๊ฒฝ์ฐ ๋ค๋ฅธ ๋ก์ปฌ์์ push ๋ ์ฝ๋๋ฅผ ํ์ฌ ๋ก์ปฌ์ ๋ด๋ ค๋ฐ์ ๋ ์ฌ์ฉํ๋ค.
ํ์ ์ ํ๋ค๋ฉด, ๋ค๋ฅธ ๊ฐ๋ฐ์๊ฐ push ํ ๊ฒ์ ๋ด ๋ก์ปฌ์์ ์ ๋ฐ์ดํธ ํด์ผํ๊ธฐ ๋๋ฌธ์
git pull # ์ด๊ฒ๋ ๋ง์ฐฌ๊ฐ์ง๋ก origin ์ต์ ์ ํด๋น์ ๋ง๊ฒ ํด์ฃผ๋ฉด ๋๋ค. git pull origin master
Summary
Git ์ ๋ถ์ฐ ๋ฒ์ ๊ด๋ฆฌ "์์คํ "
Github ์ git ์์คํ ์ ์ ๊ณตํ๋ ๊ณณ
pjt ๋ณ๋ก github ์ repository ์์ ๊ด๋ฆฌํจ
Last updated
Was this helpful?