๋ ธ์ ๋ณด๋ฉด์ ์ฐธ๊ณ ํ๊ธฐ https://www.notion.so/Git-Cheat-Sheet-54ac9c437bd94185af8171d785c225f9
๋๋ ์๋์ฐ์ด๋ฏ๋ก cmder์ ์ค์นํ๋ค. (https://cmder.net/ ์์ Download Full๋ก)
๊ทผ๋ฐ git์ด ์ค์น๋์ด์๋ ๋ดค๋๋ฐ ์๋์ด์๊ธธ๋ git์ ์ค์นํ๋ค.. (https://copycoding.tistory.com/65 ์ฐธ๊ณ )
* git์ ๋ช ๋ น์ด๋ค
- ๊ฐ๋จํ๊ฒ git ๋ช ๋ น์ด -์ต์ ์ ํ์์ผ๋ก ๋์ด ์์
- ๊ฐ์ ๋ช ๋ น์ด๋ฅผ ์ํํ๋๋ผ๋ ์ด๋ค -option ์ด๋์ ๋ฐ๋ผ ๋ค๋ฆ
- ex) git config : git์์ configuration์ ๊ด๋ จ๋ ๋ช ๋ น์ด๋ฅผ ์ํ ๊ฐ๋ฅ
- https://git-scm.com/docs git์ ๋ชจ๋ ๋ช ๋ น์ด๋ฅผ ํ์ธ ๊ฐ๋ฅ
* git --version : ๋ด ์ปดํจํฐ์ git์ด ์ด๋ค ๋ฒ์ ์ผ๋ก ์ค์น๋์ด ์๋์ง ํ์ธ
* git config --list : ์ค์ ๋ฆฌ์คํธ ํ์ธํ๊ธฐ
* git config --global -e : git config๋ฅผ global๋ก ์ค์ ๋ edit๋ก ์ด๊ธฐ
- (์ด ๋ edit ์ํ์์ ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฅํ๊ณ ๋๊ฐ๊ณ ์ถ๋ค๋ฉด :wq, ๊ทธ๋ด๊ฑฐ ๋๊ณ ์ ์ฅ ์์ด ์ข ๋ฃํ๋ ค๋ฉด :q ๋๋ฅด๊ณ enter)
* code . : ํ ์คํธ์๋ํฐ(๋๋ ๋น์ฃผ์ผ ์คํ๋์ค)๋ก ์ด์ด๋ณด๊ธฐ (์๋๋ค๋ฉด ctrl+shift+p๋ฅผ ๋๋ฌ 'Shell Command:Install 'code' command in PATH' ์ ํ
* ํธ์ง๊ธฐ๋ฅผ code๋ก ์ง์ ํ๊ณ ํธ์ง๊ธฐ ์ด๊ธฐ
git config --global core.editor "code --wait"
git config --global -e
ํธ์ง๊ธฐ๋ฅผ ์ด์ฉํ ๋์์๋ terminal์ด ๋ค๋ฅธ ๋ช ๋ น์ด๋ฅผ ๋ฐ์ ๋ค์ด์ง ์๋๋ก ๊ธฐ๋ค๋ ค์ค๋ค. ํธ์ง๊ธฐ๋ฅผ ์ข ๋ฃํด์ผ ๋ค์ ํ์ฑํ
์ด ๋ --wait์ ๋นผ๋ฒ๋ฆฌ๋ฉด ์ด๋ ๋ง๋ ๊ทธ๋ฅ ์๊ธฐ๋ค๋ ค์ฃผ๊ณ ๋ค๋ฅธ ๋ช ๋ น์ด๋ฅผ ์ ๋ ฅํ ์ ์๋๋ก ๊ณ์ ํ์ฑํ๋ผ์์
* ์ฌ์ฉ์ ์ค์
git config --global user.name "Hayeon"
git config --global user.email "idubusomuch@gmail.com"
# ์ ๋ณด ํ์ธ
git config user.name
git config user.email
* git config --global core.autocrlf true (mac์ true๊ฐ ์๋๋ผ input)
- ์ด์์ฒด์ ๋ง๋ค editor์์ ์ค๋ฐ๊ฟ์ ํ ๋ ๋ค์ด๊ฐ๋ ๋ฌธ์์ด์ด ๋ค๋ฅด๋ค.
- - window : \r\n(carriage-return, line feed)
- - mac : \n(line feed ๋ง)
- Git respository๋ฅผ ๋ค์ํ ์ด์์ฒด์ ์์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์ค๋ฐ๊ฟ ๋ฌธ์์ด์ด ๋ฌ๋ผ์ ธ์ ๋ฌธ์ ๊ฐ ์๊ธธ ์ ์์
- => ์ด๋ฅผ ์์ ํ ์ ์๋ ์์ฑ์ด autocrlf
- + ์ถ๊ฐ ์ค์
* git init : ๊น ์ด๊ธฐํ
์ดํ explorer .git (๋๋ ์๋์ฐ์ด๊ธฐ ๋๋ฌธ...)์ ์ ๋ ฅํ๋ฉด ์จ๊ฒจ์ ธ ์๋ git ํด๋๊ฐ ๋ฑ์ฅํ๋ค.
๊ทธ๋ฆฌ๊ณ ์์์๋ git init์ ์ ๋ ฅํ๋๊น ๊ฐ์๊ธฐ (master)๊ฐ ๋ถ์๋ค. ์ด๊ธฐํ๋ฅผ ํ๋ฉด master branch๊ฐ ์์ฑ๋๋๋ฐ ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก commitํด์ ๋ฒ์ ์ ๊ด๋ฆฌํ๋branch์ด๋ค.
* rm -rf .git : git์ ์ญ์
์ด ํ explorer .git์ ์ ๋ ฅํ๋ฉด ํฐ๋ฏธ๋์ด ๊ทธ๊ฒ ๋ญ๋๋ฉด์ ๊ทธ๋ฅ documents ํด๋๋ฅผ ์ด์ด์ค๋ค.
* git status : git์ ์ํ๋ฅผ ํ์ธ
* git ๊ด๋ จ ๋ช ๋ น์ด์ ์ค์๋ง(๋จ์ถํค?) ์์ฑํ๋ ์ฝ๋
git config --global alias.st status
์ด๋ฅผ ์ ๋ ฅํ๋ฉด git status๊ฐ ์๋ git st ๋ผ๊ณ ์ณ๋ ๋๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ๋์จ๋ค.
* git config --h : ๋ช ๋ น์ด ํ์ธํ๊ธฐ (๋ฌผ๋ก ๊ณต์ ์ฌ์ดํธ์์๋ ํ์ธ ๊ฐ๋ฅ)
'github' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๊น ์ค์น ๋ฐ ๊ธฐ๋ณธ์ค์ (0) | 2025.04.01 |
---|---|
3-2. ๊ธฐ๋ณธ ๋ช ๋ น์ด (0) | 2022.02.21 |
3-1. ๊ธฐ๋ณธ ๋ช ๋ น์ด (0) | 2022.02.15 |
1-2 ๋ฆฌ๋ ์ค ํฐ๋ฏธ๋ ๋ช ๋ น์ด (0) | 2022.02.12 |
1-1. Git (0) | 2022.02.07 |