git Notes
- ๋ฅ์ง
- Development
- ๋ถ๋ฅ
- git
- ๋ฑ๋ก์ผ
[GIT] Submodule (Nested Repository) ์ฌ์ฉํ๊ธฐ
์ ์ฅ์ ์ค์ฒฉ์ ๊ดํ ๋ฐฉ๋ฒ ์ค ํ๋
git subtree๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ฌ์ฉํ ์ฝ๋ ๋ ๋ฆฝ ์ํค๊ธฐ
์ ์ฅ์ ์ค์ฒฉ์ ๊ดํ ๋ฐฉ๋ฒ ์ค ํ๋
global .gitignore ์ค์ ํ๊ธฐ
์ ์ญ์ผ๋ก .gitignore ์ค์ ํด์ผํ ์ผ๋ ์๊ธด๋ค. ๊ทธ๋์ ๋ค์๊ณผ ๊ฐ์ด ์ ์ญ์ผ๋ก git commit์ ์ ์ธํ ์ ์๋ค.
๋จผ์ ์ ์ธํ ํ์ผ์ ํธ์งํ๋ค.
nano ~/.gitignore
๋ค์๊ณผ ๊ฐ์ด global config๋ก ์ค์ ํ๋ค.
git config --global core.excludesFile ~/.gitignore
์ถ์ฒ: https://gist.github.com/subfuzion/db7f57fff2fb6998a16c
GIT ๊ณผ์
- ์ ์ฅ์ ๋ง๋ค๊ธฐ
git init - ์ ์ฅ์ ๋ฐ์์ค๊ธฐ
git clone ์ ์ฅ์์ฃผ์ - ์ธ๋ฑ์ค ์ถ๊ฐ
git add <ํ์ผ์ด๋ฆ>
git add * - ์ปค๋ฐํ๊ธฐ
git commit -m โํ์ ๋ณธ์ ๊ดํ ์ค๋ช โ - ๋ด์ฉ ๋ฐํํ๊ธฐ
์๊ฒฉ์๋ฒ ์ฃผ์๋ฅผ git์๊ฒ ์๋ฆฌ๊ธฐ
git remote add origin <์๊ฒฉ์๋ฒ์ฃผ์>
์๊ฒฉ์๋ฒ๋ก ์ฌ๋ฆฌ๊ธฐ
git push origin master
submodule ์ ์ฅ์๋ค ์ ๋ถ ์ ๋ฐ์ดํธํ๊ธฐ
git submodule foreach git pull origin main
submodule ๋ก ์ฌ์ฉํ๋ ์์ ์ ์ฅ์ ๊ฐ์ ธ์ค๊ธฐ
์๋ธ๋ชจ๋์ด ์๋ ์ํ์์ ์ ์ฅ์๋ฅผ ํด๋ก๋ ๋ฐ์ผ๋ฉด ์๋ธ๋ชจ๋์ชฝ ์ ์ฅ์๊ฐ ๋น์ด์๋ ์ํ์ผ ์ ์๋๋ฐ ๋ค์๊ณผ ๊ฐ์ด ์์ค์ฝ๋๋ฅผ ๋ฐ์์ฌ ์ ์๋ค.
git submodule init
git submodule update --remote --merge
0๊ฐ์ ๋๊ธ
๋ฑ๋ก๋ ๋๊ธ์ด ์์ต๋๋ค.