๐ Git ๋ฐ GitHub ์์ํ๊ธฐ: ์ด๋ณด์ ๊ฐ์ด๋
Source: Dev.to
What and Why: Git vs. GitHub
- ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ ๋ ์ด์ ๋ฒ์ ์ผ๋ก ๋๋๋ฆด ์ ์์ต๋๋ค.
- ์๋ก์ ์์ ์ ๋ฎ์ด์ฐ์ง ์์ผ๋ฉด์ ํ์๊ณผ ํ์ ํ ์ ์์ต๋๋ค.
- ๋๊ฐ ์ธ์ ์ด๋ค ๋ณ๊ฒฝ์ ํ๋์ง ํ์ธํ ์ ์์ต๋๋ค.
GitHub๋ Git ์ ์ฅ์๋ฅผ ํธ์คํ ํ๋ ํด๋ผ์ฐ๋ ๊ธฐ๋ฐ ํ๋ซํผ์ผ๋ก, ํ์ , ์ด์ ์ถ์ , ์ฝ๋ ๋ฆฌ๋ทฐ๋ฅผ ์ํ ์ถ๊ฐ ๋๊ตฌ๋ฅผ ์ ๊ณตํฉ๋๋ค. ์๊ฒฉ ์ ์ฅ์ ํธ์คํ ์ ์ ๊ณตํ๋ฉฐ Git๊ณผ ํตํฉ๋์ด ํ์ํฌ๋ฅผ ๋ ์ฝ๊ฒ ๋ง๋ค์ด ์ค๋๋ค.
Your First Steps: Setting Up a Project
1. Tracking changes
git init # Initialize a new repository
git status # See untracked or modified files
git add # Stage selected changes
git commit -m "Message" # Create a snapshot with a descriptive label
2. Pushing code to GitHub
-
GitHub.com์์ ์ ์ ์ฅ์๋ฅผ ๋ง๋ญ๋๋ค.
-
์ ์ฅ์ URL์ ๋ณต์ฌํฉ๋๋ค. ์:
https://github.com/your-username/my-project.git. -
๋ก์ปฌ ํด๋๋ฅผ ์๊ฒฉ ์ ์ฅ์์ ์ฐ๊ฒฐํฉ๋๋ค(ํ ๋ฒ๋ง ์คํ):
git remote add origin https://github.com/your-username/my-project.git -
์ฝ๋๋ฅผ ํธ์ํฉ๋๋ค:
git push -u origin main
3. Pulling code from GitHub
git pull origin main
Basic Workflow Summary
-
์น ์ธํฐํ์ด์ค๋ฅผ ํตํด GitHub์์ ์ ์ ์ฅ์๋ฅผ ๋ง๋ญ๋๋ค.
-
๋ก์ปฌ ๋จธ์ ์ ํด๋ก ํฉ๋๋ค:
git clone https://github.com/your-username/my-project.git -
์์ ๋๋ ํฐ๋ฆฌ์์ ๋ณ๊ฒฝ์ ํฉ๋๋ค.
-
๋ณ๊ฒฝ์ ์คํ ์ด์งํฉ๋๋ค:
git add . -
๋ฉ์์ง๋ฅผ ํฌํจํด ์ปค๋ฐํฉ๋๋ค:
git commit -m "Describe your changes" -
GitHub์ ํธ์ํฉ๋๋ค:
git push -u origin main
Happy coding, and may your code always be perfectly versionโcontrolled! โจ๐ป