git config --global user.name <username>
git config --global user.email <email>
git config --global user.name <username>
git config --global user.email <email>
git config --global core.autocrlf true
git config --global core.autocrlf input
git config --global core.editor <editor>
git config --list
git config <key>
Repository :
์์ค์ฝ๋๊ฐ ์ ์ฅ๋์ด ์๋ ์ฌ๋ฌ ๊ฐ์ Branch๊ฐ ๋ชจ์ฌ์๋ ๋์คํฌ์์ ๋ฌผ๋ฆฌ์ ๊ณต๊ฐ
Local Repository์ Remote Repository๋ก ๊ตฌ๋ถ
Checkout :
ํน์ ์์ ์ด๋ Branch์ ์์ค์ฝ๋๋ก ์ด๋ํ๋ ๊ฒ์ ์๋ฏธ
Checkout ๋์ - Branch, Commit, Tag
Checkout์ ํตํด ๊ณผ๊ฑฐ ์ฌ๋ฌ ์์ ์ ์ฝ๋๋ก ์ด๋์ด ๊ฐ๋ฅ
Stage :
์์
ํ ๋ด์ฉ์ด ์ฌ๋ผ๊ฐ๋ ์์์ ์ฅ์์ญ
์ด ์์ญ์ ์ด์ฉํ์ฌ ์์
ํ ๋ด์ฉ ์ค commit์ ๋ฐ์ํ ํ์ผ๋ง ์ ๋ณํ์ฌ commit์ ์ํํ ์ ์์
Commit :
์์
ํ ๋ด์ฉ์ Local Repository์ ์ ์ฅํ๋ ๊ณผ์
๊ฐ๊ฐ์ commit์ ์๋ฏธ์๋ ๋ณ๊ฒฝ๋จ์์ด๊ณ , ๋ณ๊ฒฝ์ ๋ํ ์ค๋ช
์ commit log๋ก ๋จ๊น
๊ถ์ฅ - commit์ ์๋ผ์ง ๋ง์ธ์
์ฐธ๊ณ - commit๋จ์๋ commit log format์ ์ ํด๋์ ํ์ฌ๋ ํ๋ ์์(๋น๋ ์๋ฒ๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ)
Tag :
์์์ commit ์์น์ ์ฝ๊ฒ ์ฐพ์๊ฐ ์ ์๋๋ก ๋ถ์ฌ๋์ ์ด์ ํ
Tag๊ฐ ๋ถ์ commit์ commit id(version) ๋์ tag name์ผ๋ก ์ฝ๊ฒ checkout ๊ฐ๋ฅ
Push :
Local Repository์ ๋ด์ฉ ์ค, Remote Repository์ ๋ฐ์๋์ง ์์ commit์ Remote Repository๋ก ๋ณด๋ด๋ ๊ณผ์
๊ถ์ฅ - Pushํ๋ ์๊ฐ ๋ค๋ฅธ ๊ฐ๋ฐ์๋ค๋ ์ํฅ์ ๋ฐ์. ๊ฒ์ฆ๋์ง ์์ ์ฝ๋๋ Pushํ์ง ์๋๋ก ํจ
Pull :
Remote Repository์ ์๋ ๋ด์ฉ ์ค, Local Repository์ ๋ฐ์๋์ง ์์ ๋ด์ฉ์ ๊ฐ์ ธ์์ Local Repository์ ์ ์ฅํ๋ ๊ณผ์
๋ค๋ฅธ ํ์์ด ๋ณ๊ฒฝํ๊ณ Pushํ ๋ด์ฉ์ Local Repository์ ๊ฐ์ ธ์ฌ ์ ์์
์ฐธ๊ณ - Push๊ณผ์ ์์ Conflict(์ถฉ๋)์ด ์ผ์ด๋์ Push๊ฐ ๊ฑฐ์ ๋ ๊ฒฝ์ฐ, Pull์ ํตํด Remote Repository์ ๋ณ๊ฒฝ ๋ด์ฉ์ Local Repository์ ๋ฐ์ํ์ฌ Conflict๋ฅผ ํด๊ฒฐํ ๋ค ๋ค์ Push๋ฅผ ์๋ํด์ผ ํจ
Branch :
ํน์ ์์ (commit ๋จ์)์์ ๋ถ๊ธฐํ์ฌ ์๋ก์ด commit์ ์์ ์ ์๋ ๊ฐ์ง๋ฅผ ๋ง๋๋ ๊ฒ
๊ฐ๋ฐ์ ์ฃผ์ถ์ด ๋๋ branch๋ฅผ master branch (ํน์ main branch)๋ผ๊ณ ํจ
๋ชจ๋ branch๋ ์ต์ข
์ ์ผ๋ก ๋ค์ master branch์ merge(๋ณํฉ)๋๋ ํ์์ผ๋ก ์งํ ๋จ
Merge :
Branch์ ๋ฐ๋๊ฐ๋
์ผ๋ก ํ๋์ Branch๋ฅผ ๋ค๋ฅธ Branch์ ํฉ์น๋ ๊ณผ์
Merge๋๋ ๋ Branch๋ ์ฃผ์ข
๊ด๊ณ๊ฐ ์ฑ๋ฆฝ. ์ - dev branch๋ฅผ main branch์ merge
Merge๋๋ ๊ณผ์ ์์ Conflict(์ถฉ๋)์ด ๋ฐ์ํ๋ ๊ฒฝ์ฐ Diff๋ฅผ ์์ ํ์ฌ Conflict๋ฅผ ํด๊ฒฐํ ๋ค Merge๋ฅผ ์งํํ ์ ์์
mkdir git_ws
cd git_ws
mkdir test_project
cd Documents
mkdir git_ws
cd git_ws
mkdir test_project
cd test_project
git init
git init
ls -all
touch test.txt
ls
touch test.txt
ls
git status
git status
git add <filename>
git add test.txt
git commit -m "commit์ ๋ํ ์ค๋ช
" <filename>
git commit -m 'first commit' test.txt
git remote add origin https://github.com/<repository>.git
git remote add origin http://<username>:<token>@github.com/<repository>.git
git remote add origin https://zoe-0314:<token>@github.com/zoe-0314/test_project.git
git remote -v
git remote -v
Local Repository (HEAD)์ ๋ฐ์๋ ๋ณ๊ฒฝ ๋ด์ฉ์ Remote Repository์๋ ๋ฐ์ํ๊ธฐ ์ํด์๋ Git Push๋ฅผ ์ฌ์ฉ
Git Push
git push origin <branchname>
git push origin master
Remote Repository์ ๋ด์ฉ์ ๋ง์ถฐ Local Repository๋ฅผ ๊ฐฑ์ ํ๋ ค๋ฉด Git Pull ์ฌ์ฉ
ReadMe ํ์ผ ์์ฑ : Add a README ๋ฒํผ ํด๋ฆญ
๋ด์ฉ ํ์ธ (๋ชจ๋ Default ์ค์ ์ผ๋ก)
ํ๋จ์ Commit new file ๋ฒํผ ์ ํ
README ํ์ผ ์์ฑ ํ์ธ
git pull origin <branchname>
git pull origin master
mkdir exam_project
git init
touch exam.txt
git add exam.txt
git status
git commit -m 'first commit' exam.txt
git status
git remote add orign https://zoe-0314:<token>@github.com/zoe-0314/exam_project.git
git remote -v
git push orign master
git status
git pull orign master
ls
cat exam.txt
touch exam2.txt
git status
git add exam2.txt
git commit -m 'exam2.txt' exam2.txt
git push orign master
git pull orign master
cat exam2.txt
touch exam3.txt
exam3.txt ํ์ผ์ ๊ธ ์ ๋ ฅํ๊ธฐ(๊ธ ์ ๋ ฅํ๊ณ ctrl + d๋ก ์ ์ฅํ๋ฉด ๋์์ง)
cat > exam3.txt
cat exam3.txt
git add exam3.txt
git status
git commit -m 'commit 3' exam3.txt
git status
git push orign master
git pull orign master
cat exam3.txt
Git Home ์์ Repositoreis 'New' ๋ฒํผ ์ ํ
HelloGit ์์ฑ : README File & .gitignore (python) ์ ํ > Create repository
HelloGit ์์ฑ ํ์ธ
README FILE : ํ๋ก์ ํธ์ ๋ํ ์ค๋ช , ์ฌ์ฉ๋ฐฉ๋ฒ, ๋ผ์ด์ผ์ค, ์ค์น๋ฐฉ๋ฒ ๋ฑ์ ๋ํ ๋ด์ฉ์ ๊ธฐ์ ํ๋ ํ์ผ, ๋, ์ง์ฅ๋๋ฃ, ํ๋ก๊ทธ๋จ ์ฌ์ฉ์๋ฅผ ์ํด ์กด์ฌ
gitignore : Git ๋ฒ์ ๊ด๋ฆฌ์์ ์ ์ธํ ํ์ผ๋ชฉ๋ก์ ์ง์ ํ๋ ํ์ผ, ์ฌ์ฉ์๊ฐ ์ํ์ง ์๋ ํ์ผ๋ค์ ์๋์ผ๋ก commit ๋์์์ ์ ์ธ์์ผ ์ค
Local Repository ๋ฅผ ์์ฑํ์ง ์์ ์ํ์์ Git Clone ๋ช ๋ น์ ์ฌ์ฉํ์ฌ Remote Repository ๋ฅผ Local ์ ๋ณต์ ํ ์ ์์
Git Clone :
์์ ํด๋๋ฅผ ๋ง๋ค๊ณ
git clone https://github.com/<repositoroy>.git
git clone https://<username>:<token>@github.com/<repository>.git
Remote Repository ์ฃผ์ ๋ณต์ฌ
Workspace ๋ก ์ด๋ํ์ฌ Clone
git clone https://zoe-0314:<token>@github.com/zoe-0314/HelloGit.git
Local Repository ์์ฑ ํ์ธ
ls
cd HelloGit
cat README.md
ls -all
git branch
git branch
git branch -r
gir branch -r
git branch -a
git branch -a
git branch <branchname>
git branch branch01
git checkout <branchname>
git checkout branch01
git branch
git checkout -b <branchname>
git checkout -b branch02
git branch
git push origin <branchname>
git push origin branch01
git branch -a
git push origin branch02
git branch -a
git branch -d <branchname>
git branch -d branch02
git checkout main
git branch -d branch02
git branch
git branch -d branch01
git branch -a
git push origin --delete <branchname>
git push origin --delete branch02
git branch -a
git push origin --delete branch01
git branch -a
cd ..
git clone https://zoe-0314:<token>@github.com/zoe-0314/branch_project.git
ls -all
cd branch_project
git branch branch01
git checkout -b branch02
git checkout branch01
git branch -a
git push origin branch01
git push origin branch02
git branch -a
git checkout main
git branch -d branch01
git branch -a
git branch -d branch02
git branch -a
git push origin --delete branch01
git push origin --delete branch02
git branch -a
์์ํ๋ค..์ด๋ ต..
๐ป ์ถ์ฒ : ์ ๋ก๋ฒ ์ด์ค ๋ฐ์ดํฐ ์ทจ์ ์ค์ฟจ