๐คด์์ด๋ณด์ git/github ๊ฐ์ฒ๊ธฐ
์ฌ์ฉ์ ๋ฑ๋ก
1
2
3
4
5
6
git config --global user.name ์ฌ์ฉ์ ์ด๋ฆ
git config --global user.email ์ฌ์ฉ์ ์ด๋ฉ์ผ
// ํ๋ก์ ํธ๋ง๋ค ๋ค๋ฅธ ๊ณ์ ์ ์ฌ์ฉํด์ผ ํ ๊ฒฝ์ฐ
git config --local user.name ์ฌ์ฉ์ ์ด๋ฆ
git config --local user.email ์ฌ์ฉ์ ์ด๋ฉ์ผ
์ ์ฅ์ ์ฐ๊ฒฐ
1
2
git remote add origin ๊นํ๋ธ ์ฃผ์
git remote -v
์ ์ฅ์ ์ฐ๊ฒฐ ์ญ์
1
git remote remove origin
์ ์ฅ์์ ์ ๋ก๋
1
2
3
4
5
6
git init
git add .
git commit -m '์ปค๋ฐ ๋ด์ฉ'
git push origin master
// git push -u origin master
// -u๋ฅผ ์ฐ๋ฉด ์์ผ๋ก ์๋์ผ๋ก ์ ๋ธ๋ฐ์น๋ก push ํ๊ฒ ๋ค๋ ๋ป
push ๋์๋ง
1
git push --help
ํน์ ํด๋/ํ์ผ ์ ์ธํ๊ณ ์ปค๋ฐ
1
2
3
4
5
6
7
touch .gitignore
ls -a
vi .gitignore
i > ์ ์ธํ ํด๋/ํ์ผ๋ช
์
๋ ฅ (ex. download/, *.log) > esc > :wq!
git add .
git commit -m '์ปค๋ฐ ๋ด์ฉ'
git push
์ ์ฅ์์ ์ด๋ฏธ ์ฌ๋ฆฐ ํด๋/ํ์ผ ์ญ์
1
2
3
git rm -r ํด๋/ํ์ผ๋ช
(ex. js/bin)
git commit -m '์ปค๋ฐ ๋ด์ฉ'
git push
ํน์ branch ์ ๋ฐ์ดํธ ๋ด์ฉ pull
1
git pull origin ๋ธ๋์น์ด๋ฆ
๋ง์ง๋ง pull ์ทจ์
1
2
3
git reset --keep HEAD@{1}
// ํน์
git reset HEAD~1
๋ง์ง๋ง ์ปค๋ฐ ๋ฉ์์ง ์์
1
2
3
4
git commit --amend
// i ํค ๋๋ฅด๋ฉด ์์ ๊ฐ๋ฅํ๋๋ก ๋ณ๊ฒฝ๋จ. ์์ ํ :wq๋ก ์ ์ฅ, ํน์ :qa!๋ก ์ข
๋ฃ
// ํน์
git commit --amend -m "an updated commit message"
branch ์กฐํ
1
2
3
git branch
// ์๊ฒฉ ๋ธ๋์น๋ฅผ ํฌํจํ ๋ชจ๋ ๋ธ๋์น ๋ชฉ๋ก
git branch -a
branch ๋ง๋ค๊ธฐ
1
git checkout -b ๋ธ๋์น์ด๋ฆ
branch ์ ํํ๊ธฐ
1
git checkout ๋ธ๋์น์ด๋ฆ
branch ์ญ์ ํ๊ธฐ
1
git branch -d ๋ธ๋์น์ด๋ฆ
branch ์ด๋ฆ ๋ณ๊ฒฝํ๊ธฐ
1
git branch -m ๋ณ๊ฒฝ์ _branch_name ์๋ก์ด_branch_name
์๊ฒฉ branch ์ด๋ฆ ๋ณ๊ฒฝํ๊ธฐ
1
git push origin -u ์๋ก์ด_branch_name
.git ํ์ผ ์ญ์
1
rm -rf .git
ignorecase
ํ์ผ๋ช ๋์๋ฌธ์๋ฅผ ๋ฐ๊ฟจ๋๋ฐ git ๋ณ๊ฒฝ ๋ด์ฉ์ ๋จ์ง ์๋ ๊ฒฝ์ฐ
1
git config core.ignorecase false
This post is licensed under CC BY 4.0 by the author.