๐etc.
[Git] Git ํ์๊ด๋ฆฌ
taesooya
2022. 8. 3. 15:18
22.08.03
Git
- ํ์๊ด๋ฆฌ ํ๋ก๊ทธ๋จ
- ๋ฒ์ ์ปจํธ๋กค ์์คํ VCS
- ๋ถ์ฐํ ํ์๊ด๋ฆฌ
- ๋ฆฌ๋ ์ค ์ฐฝ์์์ธ ๋ฆฌ๋์ค ํ ๋ฐ์ฆ๊ฐ ๊ฐ๋ฐ
GitHub
- ์๊ฒฉ ์ ์ฅ์๋ฅผ ์ ๊ณตํ๋ ๋ฌด๋ฃ ์น ์๋น์ค
- 2018๋ ๋ง์๊ฐ ์ธ์
- ์ ์ธ๊ณ์์ ๊ฐ์ฅ ํฐ ์คํ์์ค ์ ์ฅ์
- ์ ์ฌ : Gitlab / Bitbucket
- ํ๋ก๊ทธ๋๋จธ์ ํฌํธํด๋ฆฌ์ค
์ฉ์ด
๋ฆฌํฌ์งํ ๋ฆฌ Repository
- ์ ์ฅ์, ์ ์ฅ๊ณต๊ฐ, HDD
- ์ ์ฅ ์์น์ ๋ฐ๋ผ ๊ตฌ๋ถ
- ๋ก์ปฌ ๋ฆฌํฌ์งํ ๋ฆฌ
- ๋ฆฌ๋ชจํธ ๋ฆฌํฌ์งํ ๋ฆฌ
- project (Add / Commit)→ Local Repository (Push)→ Remote Repository
- Remote Repository (Pull)→ Local Repository
ํ์ Git ๋ช ๋ น์ด
- working directory (git add) → staging Area (git commit) → Repos (git push) → Remote Repos
- working directory ← (git reset) staging Area ← Repos ← (git pull) Remote Repos
GitFlow ๋ฐฉ๋ฒ๋ก
- Master Branch (ํ์ฅ๋ง ๊ด๋ฆฌ)
- ํญ์ ์ถ์ ๊ฐ๋ฅํ ์์ฑ๋ณธ
- Develop Branch
- ํ์ ๊ฐ์ ์์ ๋ฌผ์ ๋ณํฉํ๋ ๋ธ๋์น
- ์ค๋ฅ๊ฐ ์์ด์ผ ํ๋ ๋ธ๋์น (์ค๋ฅ ์์์ Push X), ํด๋ฆฐ ์ฝ๋๋ง
- ์ฃผ๊ธฐ์ ์ผ๋ก Master ๋ธ๋์น๋ก ๋ณํฉ (ํ์ฅ์ด Merge)
- ๊ฐ์ธ ๊ฐ๋ฐ ๋ธ๋์น
- ํ์ ๊ฐ์ธ์ด ์์ ํ๋ ๋ธ๋์น
- ์ค๋ฅ๊ฐ ์๋ ์ฝ๋๋ฅผ Develop ๋ธ๋์น๋ก ๋ณํฉ
- ๋งค์ผ pull / push ๊ฐ ์ด๋ฃจ์ด์ ธ์ผ ํจ
- ์ ์ ํ ์ชผ๊ฐ์ด Commit
- Asset Import ์ ์ Commit / ์คํจ์ Rollback
Git ์ค์ต
- whoami ⇒ PC ์ด๋ฆ ์ถ๋ ฅ
- pwd ⇒ print working directory
- ls ⇒ List
- ls -al ⇒ List ์์ธ viewl
- clear
- mkdir ⇒ make directory
- . : ํ์ฌ dir
- .. : ์ด์ dir
- history : ์ฌ์ฉํ ๋ช
๋ น์ด ์ถ๋ ฅ
- !๋ฒํธ ⇒ ํด๋น ๋ช ๋ น์ด
- rm -rf “๋๋ ํ ๋ฆฌ์ด๋ฆ”
- remove -recursive force
- git —version
- git config --global user.email "ihj04982@gmail.com"
- git config --global user.name "Heejeong Lim"
- git config —unset user.~~
- git init : Initialize empty git repository
- .git ํด๋ : local Repository
- touch a.txt
- git add a.txt
- git commit -m
- -message
- git commit ⇒ editor๋ก ๋ค์ด๊ฐ ⇒ ESC : q! ์ ๋ ฅ์ ๋น ์ ธ๋์ด
- git log ⇒ commit ๋ด์ญ ์ถ๋ ฅ
- git reset —hard 9739a7f9cbc11222af4bfca765a916912a1b6a8b
- git branch ๋ธ๋์น๋ช ⇒ ๋ธ๋์น ๋ง๋ค๊ธฐ
- git branch ⇒ ๋ธ๋์น ๋ชฉ๋ก
- git checkout ๋ธ๋์น๋ช ⇒ switch to ๋ธ๋์น๋ช branch
- echo ⇒ print / Debug.Log
- echo “Unity” >> b.txt ⇒ b.txt์ “~” ๋ฐ์ด ๋ฃ๊ธฐ
- git merge develop ํ์ฌ ๋ธ๋์น์ develop์ ๋ณํฉ์ํด
- cat b.txt
- <<<< Current Change
- >>>>Incoming Change
- ์ถฉ๋์ ์ถฉ๋ ์์ ํ add, commint
ํ์ฅ ํ๋ก์ ํธ ๋ง๋ค์ด ์ด๊ธฐ ์ค์ ํ๊ธฐ
- git init : ๊น ์ด๊ธฐํ
- git remote add origin https:// ⇒ ์ฐ๊ฒฐ https://.git , ์ฃผ์ origin์ผ๋ก ๋ณ์นญ์ผ๋ก ์ค์
- git remote -v
- git pull origin main(๋ธ๋์น) ⇒ main ๋ธ๋์น์ .gitignore pullํ๊ธฐ
- **Git LFS**
- git lfs install (๋ค์ด๋ก๋)
- git lfs install (์ ๋ ฅ)
- **Git attributes**
- vi .gitattributes
- esc + I + ctrl v (https://gist.githubusercontent.com/nemotoo/b8a1c3a0f1225bb9231979f389fd4f3f/raw/dc3e8cab80fc62d1c60db70c761b1ffa636aa796/.gitattributes)
- esc + :wq! (์ ์ฅํ๊ณ w ๋๊ฐ๊ธฐ q !)
- git add . : ํ์ฌ ํด๋ ๋ด ๋ชจ๋ add
- git push origin master
ํ์
- git clone —branch develop https://github.com/i~~~.git
- git add
- git commit
- git push origin master