Skip to content

Latest commit

ย 

History

History
1285 lines (1102 loc) ยท 61.1 KB

submodules.asc

File metadata and controls

1285 lines (1102 loc) ยท 61.1 KB

์„œ๋ธŒ๋ชจ๋“ˆ

ํ”„๋กœ์ ํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋‹ค ๋ณด๋ฉด ๋‹ค๋ฅธ ํ”„๋กœ์ ํŠธ๋ฅผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์ข…์ข… ์žˆ๋‹ค. ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ๋‹ค๋ฅธ ํ”„๋กœ์ ํŠธ๋Š” ์™ธ๋ถ€์—์„œ ๊ฐœ๋ฐœํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ผ๋˜๊ฐ€ ๋‚ด๋ถ€ ์—ฌ๋Ÿฌ ํ”„๋กœ์ ํŠธ์—์„œ ๊ณตํ†ต์œผ๋กœ ์‚ฌ์šฉํ•  ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ผ ์ˆ˜ ์žˆ๋‹ค. ์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ ์ž์ฃผ ์ƒ๊ธฐ๋Š” ์ด์Šˆ๋Š” ๋‘ ํ”„๋กœ์ ํŠธ๋ฅผ ์„œ๋กœ ๋ณ„๊ฐœ๋กœ ๋‹ค๋ฃจ๋ฉด์„œ๋„ ๊ทธ ์ค‘ ํ•˜๋‚˜๋ฅผ ๋‹ค๋ฅธ ํ•˜๋‚˜ ์•ˆ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•œ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.

Atom ํ”ผ๋“œ๋ฅผ ์ œ๊ณตํ•˜๋Š” ์›น์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์„ ์˜ˆ๋กœ ๋“ค์–ด๋ณด์ž. Atom ํ”ผ๋“œ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์ฝ”๋“œ๋Š” ์ง์ ‘ ์ž‘์„ฑํ•˜์ง€ ์•Š๊ณ  ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๊ฐ€์ ธ๋‹ค ์“ฐ๊ธฐ๋กœ ํ•œ๋‹ค. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด CPAN์ด๋‚˜ Ruby gem ๊ฐ™์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๊ด€๋ฆฌ ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Shared ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ํ˜•ํƒœ๋กœ ์“ฐ๊ฑฐ๋‚˜ ์ง์ ‘ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ํ”„๋กœ์ ํŠธ๋กœ ๋ณต์‚ฌํ•ด์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ์šฐ์„  Shared ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ์—๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค. ํ”„๋กœ์ ํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ชจ๋“  ํ™˜๊ฒฝ์— ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์–ด์•ผ ํ•˜๊ณ  ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ”„๋กœ์ ํŠธ์— ๋งž๊ฒŒ ์•ฝ๊ฐ„ ์ˆ˜์ •ํ•ด์„œ ์‚ฌ์šฉํ•˜๊ณ  ๋ฐฐํฌํ•˜๊ธฐ๊ฐ€ ์–ด๋ ต๋‹ค. ๋˜ํ•œ, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์ง์ ‘ ํ”„๋กœ์ ํŠธ์— ํฌํ•จ์‹œํ‚ค๋Š” ๊ฒฝ์šฐ์—๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ Upstream ์ฝ”๋“œ๊ฐ€ ์—…๋ฐ์ดํŠธ๋์„ ๋•Œ Merge ํ•˜๊ธฐ๊ฐ€ ์–ด๋ ต๋‹ค.

Git์˜ ์„œ๋ธŒ๋ชจ๋“ˆ์€ ์ด๋Ÿฐ ๋ฌธ์ œ๋ฅผ ๋‹ค๋ฃจ๋Š” ๋„๊ตฌ๋‹ค. Git ์ €์žฅ์†Œ ์•ˆ์— ๋‹ค๋ฅธ Git ์ €์žฅ์†Œ๋ฅผ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๋ถ„๋ฆฌํ•ด ๋„ฃ๋Š” ๊ฒƒ์ด ์„œ๋ธŒ๋ชจ๋“ˆ์ด๋‹ค. ๋‹ค๋ฅธ ๋…๋ฆฝ๋œ Git ์ €์žฅ์†Œ๋ฅผ Clone ํ•ด์„œ ๋‚ด Git ์ €์žฅ์†Œ ์•ˆ์— ํฌํ•จํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ๊ฐ ์ €์žฅ์†Œ์˜ ์ปค๋ฐ‹์€ ๋…๋ฆฝ์ ์œผ๋กœ ๊ด€๋ฆฌํ•œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ์‹œ์ž‘ํ•˜๊ธฐ

์˜ˆ์ œ๋กœ ํ•˜์œ„ ํ”„๋กœ์ ํŠธ ์—ฌ๋Ÿฌ ๊ฐœ๋ฅผ ๊ฐ€์ง€๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋‚˜ ๋งŒ๋“ค์–ด ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๊ธฐ๋Šฅ์„ ์‚ดํŽด๋ณด์ž.

์ž‘์—…ํ•  Git ์ €์žฅ์†Œ์— ๋ฏธ๋ฆฌ ์ค€๋น„๋œ ๋ฆฌ๋ชจํŠธ Git ์ €์žฅ์†Œ๋ฅผ ์„œ๋ธŒ๋ชจ๋“ˆ๋กœ ์ถ”๊ฐ€ํ•ด๋ณด์ž. ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ช…๋ น์œผ๋กœ git submodule add ๋’ค์— ์ถ”๊ฐ€ํ•  ์ €์žฅ์†Œ์˜ URL์„ ๋ถ™์—ฌ์ค€๋‹ค. ์ด URL์€ ์ ˆ๋Œ€๊ฒฝ๋กœ๋„ ๋˜๊ณ  ์ƒ๋Œ€๊ฒฝ๋กœ๋„ ๋œ๋‹ค. ์˜ˆ์ œ๋กœ โ€œDbConnectorโ€ ๋ผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค.

$ git submodule add https://github.com/chaconinc/DbConnector
Cloning into 'DbConnector'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 11 (delta 0), reused 11 (delta 0)
Unpacking objects: 100% (11/11), done.
Checking connectivity... done.

๊ธฐ๋ณธ์ ์œผ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์€ ํ”„๋กœ์ ํŠธ ์ €์žฅ์†Œ์˜ ์ด๋ฆ„์œผ๋กœ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๋งŒ๋“ ๋‹ค. ์˜ˆ์ œ์—์„œ๋Š” โ€œDbConnectorโ€ ๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ๋งŒ๋“ ๋‹ค. ๋ช…๋ น์˜ ๋งˆ์ง€๋ง‰์— ์›ํ•˜๋Š” ์ด๋ฆ„์„ ๋„ฃ์–ด ๋‹ค๋ฅธ ๋””๋ ‰ํ† ๋ฆฌ ์ด๋ฆ„์œผ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ•˜๊ณ  ๋‚œ ํ›„ git status ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ๋ช‡ ๊ฐ€์ง€ ์ •๋ณด๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   .gitmodules
    new file:   DbConnector

์šฐ์„  .gitmodules ํŒŒ์ผ์ด ๋งŒ๋“ค์–ด์กŒ๋‹ค. ์ด ํŒŒ์ผ์€ ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ์™€ ํ•˜์œ„ ํ”„๋กœ์ ํŠธ URL์˜ ๋งคํ•‘ ์ •๋ณด๋ฅผ ๋‹ด์€ ์„ค์ •ํŒŒ์ผ์ด๋‹ค.

[submodule "DbConnector"]
    path = DbConnector
    url = https://github.com/chaconinc/DbConnector

์„œ๋ธŒ๋ชจ๋“ˆ ๊ฐœ์ˆ˜๋งŒํผ ์ด ํ•ญ๋ชฉ์ด ์ƒ๊ธด๋‹ค. ์ด ํŒŒ์ผ๋„ .gitignore ํŒŒ์ผ์ฒ˜๋Ÿผ ๋ฒ„์ „์„ ๊ด€๋ฆฌํ•œ๋‹ค. ๋‹ค๋ฅธ ํŒŒ์ผ์ฒ˜๋Ÿผ Push ํ•˜๊ณ  Pull ํ•œ๋‹ค. ์ด ํ”„๋กœ์ ํŠธ๋ฅผ Clone ํ•˜๋Š” ์‚ฌ๋žŒ์€ .gitmodules ํŒŒ์ผ์„ ๋ณด๊ณ  ์–ด๋–ค ์„œ๋ธŒ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ๊ฐ€ ์žˆ๋Š”์ง€ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

Note
gitmodules ํŒŒ์ผ์— ์žˆ๋Š” URL์€ ์กฐ๊ฑด์— ๋งž๋Š” ์‚ฌ๋žŒ์ด๋ฉด ๋ˆ„๊ตฌ๋“ ์ง€ Clone ํ•˜๊ณ  Fetch ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•œ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด ๋‹ค๋ฅธ ์‚ฌ๋žŒ์ด Pull์„ ํ•˜๋Š” URL๊ณผ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ์ž‘์—…์„ Push ํ•˜๋Š” URL์ด ์„œ๋กœ ๋‹ค๋ฅธ ์ƒํ™ฉ์ด๋ผ๋ฉด Pull URL์ด ๋ชจ๋“  ์‚ฌ๋žŒ์—๊ฒŒ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ URL์ด์–ด์•ผ ํ•œ๋‹ค. ์ด๋Ÿฌ๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ URL ์„ค์ •์„ ๋ฎ์–ด์“ฐ๊ธฐ ํ•ด์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ git config submodule.DbConnector.url PRIVATE_URL ๋ช…๋ น์œผ๋กœ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๊ณผ๋Š” ๋‹ค๋ฅธ ์„œ๋ธŒ๋ชจ๋“ˆ URL์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. URL์„ ์ƒ๋Œ€๊ฒฝ๋กœ๋กœ ์ ์„ ์ˆ˜ ์žˆ์œผ๋ฉด ์ƒ๋Œ€๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋‚ซ๋‹ค.

.gitmodules ์€ ์‚ดํŽด๋ดค๊ณ  ์ด์ œ ํ”„๋กœ์ ํŠธ ํด๋”์— ๋Œ€ํ•ด ์‚ดํŽด๋ณด์ž. git diff ๋ช…๋ น์„ ์‹คํ–‰์‹œํ‚ค๋ฉด ํฅ๋ฏธ๋กœ์šด ์ ์„ ๋ฐœ๊ฒฌํ•  ์ˆ˜ ์žˆ๋‹ค.

$ git diff --cached DbConnector
diff --git a/DbConnector b/DbConnector
new file mode 160000
index 0000000..c3f01dc
--- /dev/null
+++ b/DbConnector
@@ -0,0 +1 @@
+Subproject commit c3f01dc8862123d317dd46284b05b6892c7b29bc

Git์€ DbConnector ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์„œ๋ธŒ๋ชจ๋“ˆ๋กœ ์ทจ๊ธ‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์˜ ํŒŒ์ผ ์ˆ˜์ •์‚ฌํ•ญ์„ ์ง์ ‘ ์ถ”์ ํ•˜์ง€ ์•Š๋Š”๋‹ค. ๋Œ€์‹  ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ํ†ต์งธ๋กœ ํŠน๋ณ„ํ•œ ์ปค๋ฐ‹์œผ๋กœ ์ทจ๊ธ‰ํ•œ๋‹ค.

git diff ์— --submodule ์˜ต์…˜์„ ๋”ํ•˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ์— ๋Œ€ํ•ด ๋” ์ž์„ธํžˆ ๋‚˜์˜จ๋‹ค.

$ git diff --cached --submodule
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..71fc376
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "DbConnector"]
+       path = DbConnector
+       url = https://github.com/chaconinc/DbConnector
Submodule DbConnector 0000000...c3f01dc (new submodule)

์ด์ œ ํ•˜์œ„ ํ”„๋กœ์ ํŠธ๋ฅผ ํฌํ•จํ•œ ์ปค๋ฐ‹์„ ์ƒ์„ฑํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

$ git commit -am 'added DbConnector module'
[master fb9093c] added DbConnector module
 2 files changed, 4 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 DbConnector

DbConnector ๋””๋ ‰ํ† ๋ฆฌ์˜ ๋ชจ๋“œ๋Š” 160000 ์ด๋‹ค. Git์—๊ฒŒ ์žˆ์–ด 160000 ๋ชจ๋“œ๋Š” ์ผ๋ฐ˜์ ์ธ ํŒŒ์ผ์ด๋‚˜ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์•„๋‹ˆ๋ผ ํŠน๋ณ„ํ•˜๋‹ค๋Š” ์˜๋ฏธ๋‹ค.

๋์œผ๋กœ, Push ํ•œ๋‹ค.

$ git push origin master

์„œ๋ธŒ๋ชจ๋“ˆ ํฌํ•จํ•œ ํ”„๋กœ์ ํŠธ Clone

์„œ๋ธŒ๋ชจ๋“ˆ์„ ํฌํ•จํ•˜๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ Clone ํ•˜๋Š” ์˜ˆ์ œ๋ฅผ ์‚ดํŽด๋ณธ๋‹ค. ์ด๋Ÿฐ ํ”„๋กœ์ ํŠธ๋ฅผ Clone ํ•˜๋ฉด ๊ธฐ๋ณธ์ ์œผ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋Š” ๋นˆ ๋””๋ ‰ํ† ๋ฆฌ์ด๋‹ค.

$ git clone https://github.com/chaconinc/MainProject
Cloning into 'MainProject'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 14 (delta 1), reused 13 (delta 0)
Unpacking objects: 100% (14/14), done.
Checking connectivity... done.
$ cd MainProject
$ ls -la
total 16
drwxr-xr-x   9 schacon  staff  306 Sep 17 15:21 .
drwxr-xr-x   7 schacon  staff  238 Sep 17 15:21 ..
drwxr-xr-x  13 schacon  staff  442 Sep 17 15:21 .git
-rw-r--r--   1 schacon  staff   92 Sep 17 15:21 .gitmodules
drwxr-xr-x   2 schacon  staff   68 Sep 17 15:21 DbConnector
-rw-r--r--   1 schacon  staff  756 Sep 17 15:21 Makefile
drwxr-xr-x   3 schacon  staff  102 Sep 17 15:21 includes
drwxr-xr-x   4 schacon  staff  136 Sep 17 15:21 scripts
drwxr-xr-x   4 schacon  staff  136 Sep 17 15:21 src
$ cd DbConnector/
$ ls
$

๋ถ„๋ช…ํžˆ DbConnector ๋””๋ ‰ํ† ๋ฆฌ๋Š” ์žˆ์ง€๋งŒ ๋น„์–ด ์žˆ๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ์— ๊ด€๋ จ๋œ ๋‘ ๋ช…๋ น์„ ์‹คํ–‰ํ•ด์•ผ ์™„์ „ํžˆ Clone ๊ณผ์ •์ด ๋๋‚œ๋‹ค. ๋จผ์ € git submodule init ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ ์ •๋ณด๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๋กœ์ปฌ ํ™˜๊ฒฝ์„ค์ • ํŒŒ์ผ์ด ์ค€๋น„๋œ๋‹ค. ์ดํ›„ git submodule update ๋ช…๋ น์œผ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋ฆฌ๋ชจํŠธ ์ €์žฅ์†Œ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ  ์„œ๋ธŒ๋ชจ๋“ˆ์„ ํฌํ•จํ•œ ํ”„๋กœ์ ํŠธ์˜ ํ˜„์žฌ ์Šค๋ƒ…์ƒท์—์„œ Checkout ํ•ด์•ผ ํ•  ์ปค๋ฐ‹ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์™€์„œ ์„œ๋ธŒ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ Checkout์„ ํ•œ๋‹ค.

$ git submodule init
Submodule 'DbConnector' (https://github.com/chaconinc/DbConnector) registered for path 'DbConnector'
$ git submodule update
Cloning into 'DbConnector'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 11 (delta 0), reused 11 (delta 0)
Unpacking objects: 100% (11/11), done.
Checking connectivity... done.
Submodule path 'DbConnector': checked out 'c3f01dc8862123d317dd46284b05b6892c7b29bc'

DbConnector ๋””๋ ‰ํ† ๋ฆฌ๋Š” ๋งˆ์ง€๋ง‰์œผ๋กœ ์ปค๋ฐ‹์„ ํ–ˆ๋˜ ์ƒํƒœ๋กœ ๋ณต์›๋œ๋‹ค.

ํ•˜์ง€๋งŒ, ๊ฐ™์€ ๊ณผ์ •์„ ๋” ๊ฐ„๋‹จํ•˜๊ฒŒ ์‹คํ–‰ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ๋‹ค. ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋ฅผ Clone ํ•  ๋•Œ git clone ๋ช…๋ น ๋’ค์— --recurse-submodules ์˜ต์…˜์„ ๋ถ™์ด๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ž๋™์œผ๋กœ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  ์—…๋ฐ์ดํŠธํ•œ๋‹ค.

$ git clone --recurse-submodules https://github.com/chaconinc/MainProject
Cloning into 'MainProject'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 14 (delta 1), reused 13 (delta 0)
Unpacking objects: 100% (14/14), done.
Checking connectivity... done.
Submodule 'DbConnector' (https://github.com/chaconinc/DbConnector) registered for path 'DbConnector'
Cloning into 'DbConnector'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 11 (delta 0), reused 11 (delta 0)
Unpacking objects: 100% (11/11), done.
Checking connectivity... done.
Submodule path 'DbConnector': checked out 'c3f01dc8862123d317dd46284b05b6892c7b29bc'

์„œ๋ธŒ๋ชจ๋“ˆ ํฌํ•จํ•œ ํ”„๋กœ์ ํŠธ ์ž‘์—…

์ด์ œ ํ”„๋กœ์ ํŠธ์— ํฌํ•จ๋œ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ €์žฅ์†Œ ๋ฐ์ดํ„ฐ์™€ ์ฝ”๋“œ๋„ ๋‹ค ๋ฐ›์•„์™”๋‹ค. ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์™€ ์„œ๋ธŒ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ๋ฅผ ์˜ค๊ฐ€๋ฉฐ ํŒ€์›๊ณผ ํ˜‘์—…ํ•  ์ค€๋น„๊ฐ€ ๋˜์—ˆ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ์—…๋ฐ์ดํŠธํ•˜๊ธฐ

๊ฐ€์žฅ ๋‹จ์ˆœํ•œ ์„œ๋ธŒ๋ชจ๋“ˆ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์€ ํ•˜์œ„ ํ”„๋กœ์ ํŠธ๋ฅผ ์ˆ˜์ •ํ•˜์ง€ ์•Š๊ณ  ์ฐธ์กฐ๋งŒ ํ•˜๋ฉด์„œ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๊ฐ„๋‹จํ•œ ์˜ˆ์ œ๋กœ ์ด ๊ฒฝ์šฐ๋ฅผ ์‚ดํŽด๋ณธ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ๋ฅผ ์ตœ์‹ ์œผ๋กœ ์—…๋ฐ์ดํŠธํ•˜๋ ค๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ git fetch ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๊ณ  git merge ๋ช…๋ น์œผ๋กœ Upstream ๋ธŒ๋žœ์น˜๋ฅผ Mergeํ•œ๋‹ค.

$ git fetch
From https://github.com/chaconinc/DbConnector
   c3f01dc..d0354fc  master     -> origin/master
$ git merge origin/master
Updating c3f01dc..d0354fc
Fast-forward
 scripts/connect.sh | 1 +
 src/db.c           | 1 +
 2 files changed, 2 insertions(+)

๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋กœ ๋Œ์•„์™€์„œ git diff --submodule ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ์—…๋ฐ์ดํŠธ๋œ ์„œ๋ธŒ๋ชจ๋“ˆ๊ณผ ๊ฐ ์„œ๋ธŒ๋ชจ๋“ˆ์— ์ถ”๊ฐ€๋œ ์ปค๋ฐ‹์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ๋งค๋ฒˆ --submodule ์˜ต์…˜์„ ์“ฐ๊ณ  ์‹ถ์ง€ ์•Š๋‹ค๋ฉด diff.submodule ์˜ ๊ฐ’์„ โ€œlogโ€ ๋กœ ์„ค์ •ํ•˜๋ฉด ๋œ๋‹ค.

$ git config --global diff.submodule log
$ git diff
Submodule DbConnector c3f01dc..d0354fc:
  > more efficient db routine
  > better connection routine

์—ฌ๊ธฐ์„œ ์ปค๋ฐ‹ํ•˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ์€ ์—…๋ฐ์ดํŠธ๋œ ๋‚ด์šฉ์œผ๋กœ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์— ์ ์šฉ๋œ๋‹ค. ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์ด ์—…๋ฐ์ดํŠธํ•˜๋ฉด ์ ์šฉ๋œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ตœ์‹ ์œผ๋กœ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋” ์‰ฌ์šด ๋ฐฉ๋ฒ•๋„ ์žˆ๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ Fetch ๋ช…๋ น๊ณผ Merge ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์ง€ ์•Š์•„๋„ git submodule update --remote ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด Git์ด ์•Œ์•„์„œ ์„œ๋ธŒ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ๋ฅผ Fetch ํ•˜๊ณ  ์—…๋ฐ์ดํŠธํ•œ๋‹ค.

$ git submodule update --remote DbConnector
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 2), reused 4 (delta 2)
Unpacking objects: 100% (4/4), done.
From https://github.com/chaconinc/DbConnector
   3f19983..d0354fc  master     -> origin/master
Submodule path 'DbConnector': checked out 'd0354fc054692d3906c85c3af05ddce39a1c0644'

์ด ๋ช…๋ น์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ ์ €์žฅ์†Œ์˜ master ๋ธŒ๋žœ์น˜๋ฅผ Checkout ํ•˜๊ณ  ์—…๋ฐ์ดํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•œ๋‹ค. ์—…๋ฐ์ดํŠธํ•  ๋Œ€์ƒ ๋ธŒ๋žœ์น˜๋ฅผ ์›ํ•˜๋Š” ๋ธŒ๋žœ์น˜๋กœ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด DbConnector ์„œ๋ธŒ๋ชจ๋“ˆ ์ €์žฅ์†Œ์—์„œ ์—…๋ฐ์ดํŠธํ•  ๋Œ€์ƒ ๋ธŒ๋žœ์น˜๋ฅผ โ€œstableโ€ ๋กœ ๋ฐ”๊พธ๊ณ  ์‹ถ๋‹ค๋ฉด .gitmodules ํŒŒ์ผ์— ์„ค์ •ํ•˜๊ฑฐ๋‚˜(์ด ํŒŒ์ผ์„ ๊ณต์œ ํ•˜๋Š” ๋ชจ๋‘์—๊ฒŒ โ€œstableโ€ ๋ธŒ๋žœ์น˜๊ฐ€ ์ ์šฉ๋จ) ๊ฐœ์ธ ์„ค์ • ํŒŒ์ผ์ธ .git/config ํŒŒ์ผ์— ์„ค์ •ํ•œ๋‹ค. .gitmodules ํŒŒ์ผ์— ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด์ž.

$ git config -f .gitmodules submodule.DbConnector.branch stable

$ git submodule update --remote
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 2), reused 4 (delta 2)
Unpacking objects: 100% (4/4), done.
From https://github.com/chaconinc/DbConnector
   27cf5d3..c87d55d  stable -> origin/stable
Submodule path 'DbConnector': checked out 'c87d55d4c6d4b05ee34fbc8cb6f7bf4585ae6687'

-f .gitmodules ์˜ต์…˜์„ ํฌํ•จํ•˜์ง€ ์•Š์œผ๋ฉด ์ด ์„ค์ •์€ ๊ณต์œ ํ•˜์ง€ ์•Š๊ณ  ์‚ฌ์šฉ์ž์—๊ฒŒ๋งŒ ์ ์šฉ๋œ๋‹ค. ๋‹ค๋ฅธ ์‚ฌ๋žŒ๊ณผ ๊ณต์œ ํ•˜๋Š” ์ €์žฅ์†Œ๋ผ๋ฉด ๊ฐ™์€ ๋ธŒ๋žœ์น˜๋ฅผ ์ถ”์ ํ•˜๋„๋ก ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด ๋” ๋‚ซ๋‹ค.

์ด์ œ git status ๋ช…๋ น๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ์ƒˆ๋กœ ์—…๋ฐ์ดํŠธํ•œ ์„œ๋ธŒ๋ชจ๋“ˆ์— โ€œnew commitsโ€ ๊ฐ€ ์žˆ๋‹ค๋Š” ๊ฑธ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

  modified:   .gitmodules
  modified:   DbConnector (new commits)

no changes added to commit (use "git add" and/or "git commit -a")

์„ค์ • ํŒŒ์ผ์— status.submodulesummary ํ•ญ๋ชฉ์„ ์„ค์ •ํ•˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๊ฐ„๋‹จํžˆ ๋ณด์—ฌ์ค€๋‹ค.

$ git config status.submodulesummary 1

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   .gitmodules
    modified:   DbConnector (new commits)

Submodules changed but not updated:

* DbConnector c3f01dc...c87d55d (4):
  > catch non-null terminated lines

์„ค์ •ํ•˜๊ณ  ๋‚œ ํ›„ git diff ๋ช…๋ น์„ ์‹คํ–‰ํ•ด๋ณด์ž. .gitmodules ํŒŒ์ผ์ด ๋ณ€๊ฒฝ๋œ ๋‚ด์šฉ์€ ๋ฌผ๋ก ์ด๊ฑฐ๋‹ˆ์™€ ์—…๋ฐ์ดํŠธํ•ด์„œ ์ปค๋ฐ‹ํ•  ํ•„์š”๊ฐ€ ์ƒ๊ธด ์„œ๋ธŒ๋ชจ๋“ˆ ์ €์žฅ์†Œ์˜ ๋ณ€๊ฒฝ ๋‚ด์šฉ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

$ git diff
diff --git a/.gitmodules b/.gitmodules
index 6fc0b3d..fd1cc29 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,4 @@
 [submodule "DbConnector"]
        path = DbConnector
        url = https://github.com/chaconinc/DbConnector
+       branch = stable
 Submodule DbConnector c3f01dc..c87d55d:
  > catch non-null terminated lines
  > more robust error handling
  > more efficient db routine
  > better connection routine

์„œ๋ธŒ๋ชจ๋“ˆ์— ์‹ค์ œ๋กœ ์ปค๋ฐ‹ํ•  ์ปค๋ฐ‹๋“ค์˜ ์ •๋ณด๋ฅผ ๋ณด๊ธฐ์—๋Š” ๊ฝค ๊ดœ์ฐฎ์€ ๋ฐฉ๋ฒ•์ด๋‹ค. ๋น„์Šทํ•œ ์‹์œผ๋กœ ์ปค๋ฐ‹ํ•œ ํ›„์— ๋กœ๊ทธ์—์„œ ์œ„์™€ ๊ฐ™์ด ์‚ดํŽด๋ณด๋ ค๋ฉด git log -p ๋ช…๋ น์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

$ git log -p --submodule
commit 0a24cfc121a8a3c118e0105ae4ae4c00281cf7ae
Author: Scott Chacon <[email protected]>
Date:   Wed Sep 17 16:37:02 2014 +0200

    updating DbConnector for bug fixes

diff --git a/.gitmodules b/.gitmodules
index 6fc0b3d..fd1cc29 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,4 @@
 [submodule "DbConnector"]
        path = DbConnector
        url = https://github.com/chaconinc/DbConnector
+       branch = stable
Submodule DbConnector c3f01dc..c87d55d:
  > catch non-null terminated lines
  > more robust error handling
  > more efficient db routine
  > better connection routine

git submodule update --remote ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ชจ๋“  ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์—…๋ฐ์ดํŠธํ•œ๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ์ด ์—„์ฒญ ๋งŽ์„ ๋• ํŠน์ • ์„œ๋ธŒ๋ชจ๋“ˆ๋งŒ ์—…๋ฐ์ดํŠธํ•˜๊ณ ์ž ํ•  ์ˆ˜๋„ ์žˆ๋Š”๋ฐ ์ด๋Ÿด ๋•Œ๋Š” ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ด๋ฆ„์„ ์ง€์ •ํ•ด์„œ ๋ช…๋ น์„ ์‹คํ–‰ํ•œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ๊ด€๋ฆฌํ•˜๊ธฐ

๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์—์„œ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•  ๋•Œ ์„œ๋ธŒ๋ชจ๋“ˆ์—์„œ๋„ ๋ญ”๊ฐ€ ์ž‘์—…์„ ํ•ด์•ผ ํ•  ์ƒํ™ฉ์€ ์–ผ๋งˆ๋“ ์ง€ ์ƒ๊ธธ ์ˆ˜ ์žˆ๋‹ค. ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์—์„œ ์ž‘์—…ํ•˜๋Š” ๋„์ค‘์— ๋ง์ด๋‹ค(๋™์‹œ์— ๋‹ค๋ฅธ ์„œ๋ธŒ๋ชจ๋“ˆ๋„ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜). ๋งŒ์•ฝ Git์˜ ์„œ๋ธŒ๋ชจ๋“ˆ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๋‹ค๋ฅธ Dependency ๊ด€๋ฆฌ ์‹œ์Šคํ…œ(Maven์ด๋‚˜ Rubygem ๊ฐ™์€)์„ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

์ด๋ฒˆ ์ ˆ์—์„œ๋Š” ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ˆ˜์ •ํ•˜๊ณ  ๊ทธ ๋‚ด์šฉ์„ ๋‹ด์€ ์ปค๋ฐ‹์„ ์œ ์ง€ํ•œ ์ฑ„๋กœ ๋ฉ”์ธํ”„๋กœ์ ํŠธ์™€ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ํ•จ๊ป˜ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ดํŽด๋ณธ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ์ €์žฅ์†Œ์—์„œ git submodule update ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด Git์€ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์—…๋ฐ์ดํŠธํ•œ๋‹ค. ํ•˜์ง€๋งŒ, ์„œ๋ธŒ๋ชจ๋“ˆ ๋กœ์ปฌ ์ €์žฅ์†Œ๋Š” โ€œDetached HEADโ€ ์ƒํƒœ๋กœ ๋‚จ๋Š”๋‹ค. ์ด ๋ง์€ ๋ณ€๊ฒฝ ๋‚ด์šฉ์„ ์ถ”์ ํ•˜๋Š” ๋กœ์ปฌ ๋ธŒ๋žœ์น˜(์˜ˆ๋ฅผ ๋“ค์ž๋ฉด โ€œmasterโ€ ๊ฐ™์€)๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ๋ณ€๊ฒฝ ๋‚ด์šฉ์„ ์ถ”์ ํ•˜๋Š” ๋ธŒ๋žœ์น˜ ์—†์ด ์„œ๋ธŒ๋ชจ๋“ˆ์—์„œ ์ˆ˜์ • ์ž‘์—…์„ ํ•˜๊ฒŒ ๋˜๋ฉด ์ดํ›„์— git submodule update ๋ช…๋ น์„ ์‹คํ–‰ํ–ˆ์„ ๋•Œ ์ˆ˜์ •ํ•œ ๋‚ด์šฉ์„ ์žƒ์–ด๋ฒ„๋ฆด ์ˆ˜ ์žˆ๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ ์•ˆ์—์„œ ์ˆ˜์ •์‚ฌํ•ญ์„ ์ถ”์ ํ•˜๋ ค๋ฉด ๋‹ค๋ฅธ ์ž‘์—…์ด ์ข€ ๋” ํ•„์š”ํ•˜๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ์ด ๋ธŒ๋žœ์น˜๋ฅผ ์ถ”์ ํ•˜๊ฒŒ ํ•˜๋ ค๋ฉด ํ•  ์ผ์ด ๋‘ ๊ฐ€์ง€๋‹ค. ์šฐ์„  ๊ฐ ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๊ฐ€์„œ ์ถ”์ ํ•  ๋ธŒ๋žœ์น˜๋ฅผ Checkout ํ•˜๊ณ  ์ผ์„ ์‹œ์ž‘ํ•ด์•ผ ํ•œ๋‹ค. ์ดํ›„ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ˆ˜์ •ํ•œ ๋‹ค์Œ์— git submodule update --remote ๋ช…๋ น์„ ์‹คํ–‰ํ•ด Upstream ์—์„œ ์ƒˆ๋กœ์šด ์ปค๋ฐ‹์„ ๊ฐ€์ ธ์˜จ๋‹ค. ์ด ์ปค๋ฐ‹์„ Merge ํ•˜๊ฑฐ๋‚˜ Rebase ํ•˜๋Š” ๊ฒƒ์€ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค.

๋จผ์ € ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๊ฐ€์„œ ๋ธŒ๋žœ์น˜๋ฅผ Checkout ํ•˜์ž.

$ git checkout stable
Switched to branch 'stable'

์—ฌ๊ธฐ์„œ โ€œMergeโ€ ๋ฅผ ํ•ด๋ณด์ž. update ๋ช…๋ น์„ ์“ธ ๋•Œ --merge ์˜ต์…˜์„ ์ถ”๊ฐ€ํ•˜๋ฉด Merge ํ•˜๋„๋ก ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ์•„๋ž˜ ๊ฒฐ๊ณผ์—์„œ ์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๊ฐ€์ ธ์™€์„œ Merge ํ•˜๋Š” ๊ณผ์ •์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

$ git submodule update --remote --merge
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 2), reused 4 (delta 2)
Unpacking objects: 100% (4/4), done.
From https://github.com/chaconinc/DbConnector
   c87d55d..92c7337  stable     -> origin/stable
Updating c87d55d..92c7337
Fast-forward
 src/main.c | 1 +
 1 file changed, 1 insertion(+)
Submodule path 'DbConnector': merged in '92c7337b30ef9e0893e758dac2459d07362ab5ea'

DbConnector ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๋“ค์–ด๊ฐ€๋ฉด ์ƒˆ๋กœ ์ˆ˜์ •ํ•œ ๋‚ด์šฉ์ด ๋กœ์ปฌ ๋ธŒ๋žœ์น˜ stable ์— ์ด๋ฏธ Merge ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด์ œ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์ด DbConnector ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ˆ˜์ •ํ•ด์„œ Upstream ์ €์žฅ์†Œ์— Push ํ•œ ์ƒํƒœ์—์„œ ์šฐ๋ฆฌ๊ฐ€ DbConnector ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ˆ˜์ •ํ•˜๋ฉด ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚˜๋Š”์ง€ ์‚ดํŽด๋ณด์ž.

$ cd DbConnector/
$ vim src/db.c
$ git commit -am 'unicode support'
[stable f906e16] unicode support
 1 file changed, 1 insertion(+)

์ด์ œ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์—…๋ฐ์ดํŠธํ•˜๋ฉด ๋กœ์ปฌ ์ €์žฅ์†Œ์—์„œ ์ˆ˜์ •ํ•œ ๊ฒƒ์ด ๋ฌด์—‡์ธ์ง€ Upstream ์ €์žฅ์†Œ์—์„œ ์ˆ˜์ •๋œ ๊ฒƒ์ด ๋ฌด์—‡์ธ์ง€ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ์ด ๋‘˜์„ ํ•ฉ์ณ์•ผ ํ•œ๋‹ค.

$ git submodule update --remote --rebase
First, rewinding head to replay your work on top of it...
Applying: unicode support
Submodule path 'DbConnector': rebased into '5d60ef9bbebf5a0c1c1050f242ceeb54ad58da94'

--rebase ์˜ต์…˜์ด๋‚˜ --merge ์˜ต์…˜์„ ์ง€์ •ํ•˜์ง€ ์•Š์œผ๋ฉด Git์€ ๋กœ์ปฌ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ๋ฌด์‹œํ•˜๊ณ  ์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์€ ํ•ด๋‹น ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋ฒ„์ „์œผ๋กœ Reset์„ ํ•˜๊ณ  Detached HEAD ์ƒํƒœ๋กœ ๋งŒ๋“ ๋‹ค.

$ git submodule update --remote
Submodule path 'DbConnector': checked out '5d60ef9bbebf5a0c1c1050f242ceeb54ad58da94'

์ผ์ด ์ด๋ ‡๊ฒŒ ๋˜๋”๋ผ๋„ ๋ฌธ์ œ๊ฐ€ ์•ˆ ๋œ๋‹ค. Reset์ด ๋œ ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๊ฐ€์„œ ์ž‘์—…ํ•˜๋˜ ๋ธŒ๋žœ์น˜๋ฅผ Checkout ํ•˜๊ณ  ์ง์ ‘ origin/stable (์•„๋‹ˆ๋ฉด ์›ํ•˜๋Š” ์–ด๋– ํ•œ ๋ฆฌ๋ชจํŠธ ๋ธŒ๋žœ์น˜๋“ )์„ Merge ํ•˜๊ฑฐ๋‚˜ Rebase ํ•˜๋ฉด ๋œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ์— ์ปค๋ฐ‹ํ•˜์ง€ ์•Š์€ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ์žˆ๋Š” ์ฑ„๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์—…๋ฐ์ดํŠธํ•˜๋ฉด Git์€ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๊ฐ€์ ธ์˜ค์ง€๋งŒ, ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ €์žฅํ•˜์ง€ ์•Š์€ ์ž‘์—…์„ ๋ฎ์–ด์“ฐ์ง€ ์•Š๋Š”๋‹ค.

$ git submodule update --remote
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 4 (delta 0)
Unpacking objects: 100% (4/4), done.
From https://github.com/chaconinc/DbConnector
   5d60ef9..c75e92a  stable     -> origin/stable
error: Your local changes to the following files would be overwritten by checkout:
    scripts/setup.sh
Please, commit your changes or stash them before you can switch branches.
Aborting
Unable to checkout 'c75e92a2b3855c9e5b66f915308390d9db204aca' in submodule path 'DbConnector'

์—…๋ฐ์ดํŠธ ๋ช…๋ น์„ ์‹คํ–‰ํ–ˆ์„ ๋•Œ Upstream ์ €์žฅ์†Œ์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ๊ณผ ์ถฉ๋Œ์ด ๋‚˜๋ฉด ์•Œ๋ ค์ค€๋‹ค.

$ git submodule update --remote --merge
Auto-merging scripts/setup.sh
CONFLICT (content): Merge conflict in scripts/setup.sh
Recorded preimage for 'scripts/setup.sh'
Automatic merge failed; fix conflicts and then commit the result.
Unable to merge 'c75e92a2b3855c9e5b66f915308390d9db204aca' in submodule path 'DbConnector'

์ด๋Ÿฌ๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๊ฐ€์„œ ์ถฉ๋Œ์„ ํ•ด๊ฒฐํ•˜๋ฉด ๋œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ์ˆ˜์ • ์‚ฌํ•ญ ๊ณต์œ ํ•˜๊ธฐ

ํ˜„์žฌ ์„œ๋ธŒ๋ชจ๋“ˆ์€ ๋ณ€๊ฒฝ๋œ ๋‚ด์šฉ์„ ํฌํ•จํ•˜๊ณ  ์žˆ๋‹ค. ์ด ์ค‘ ์ผ๋ถ€๋Š” ์„œ๋ธŒ๋ชจ๋“ˆ ์ž์ฒด๋ฅผ ์—…๋ฐ์ดํŠธํ•˜์—ฌ Upstream ์ €์žฅ์†Œ์—์„œ ๊ฐ€์ ธ์˜จ ๊ฒƒ์ด๊ณ  ์ผ๋ถ€๋Š” ๋กœ์ปฌ์—์„œ ์ง์ ‘ ์ˆ˜์ •ํ•œ ๋‚ด์šฉ์ด๋‹ค. ๋กœ์ปฌ์—์„œ ์ˆ˜์ •ํ•œ ๊ฒƒ์€ ์•„์ง ๊ณต์œ ํ•˜์ง€ ์•Š์•˜์œผ๋ฏ€๋กœ ์•„๋ฌด๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ์ฝ”๋“œ์ด๋‹ค.

$ git diff
Submodule DbConnector c87d55d..82d2ad3:
  > Merge from origin/stable
  > updated setup script
  > unicode support
  > remove unnecessary method
  > add new option for conn pooling

์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ Push ํ•˜์ง€ ์•Š์€ ์ฑ„๋กœ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์—์„œ ์ปค๋ฐ‹์„ Push ํ•˜๋ฉด ์•ˆ ๋œ๋‹ค. ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ Checkout ํ•œ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์€ ์„œ๋ธŒ๋ชจ๋“ˆ์ด ์˜์กดํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์–ด๋””์„œ๋„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์—†๋Š” ์ƒํ™ฉ์ด ๋ผ ๊ณค๋ž€ํ•ด์ง„๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ์€ ์šฐ๋ฆฌ์˜ ๋กœ์ปฌ์—๋งŒ ์žˆ๋‹ค.

์ด๋Ÿฐ ๋ถˆ์ƒ์‚ฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ํ•˜๋ ค๋ฉด ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋ฅผ Push ํ•˜๊ธฐ ์ „์— ์„œ๋ธŒ๋ชจ๋“ˆ์„ ๋ชจ๋‘ Push ํ–ˆ๋Š”์ง€ ๊ฒ€์‚ฌํ•˜๋„๋ก Git์—๊ฒŒ ๋ฌผ์–ด๋ณด๋ฉด ๋œ๋‹ค. git push ๋ช…๋ น์— --recurse-submodules ์˜ต์…˜์„ ์ฃผ๊ณ  ์ด ์˜ต์…˜์˜ ๊ฐ’์œผ๋กœ โ€œcheckโ€ ๋‚˜ โ€œon-demandโ€ ๋ฅผ ์„ค์ •ํ•œ๋‹ค. โ€œcheckโ€ ๋Š” ๊ฐ„๋‹จํžˆ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋กœ์ปฌ ์ปค๋ฐ‹์ด Push ๋˜์ง€ ์•Š์€ ์ƒํƒœ๋ผ๋ฉด ํ˜„์žฌ์˜ Push ๋ช…๋ น๋„ ์‹คํŒจํ•˜๋„๋ก ํ•˜๋Š” ์˜ต์…˜์ด๋‹ค.

$ git push --recurse-submodules=check
The following submodule paths contain changes that can
not be found on any remote:
  DbConnector

Please try

    git push --recurse-submodules=on-demand

or cd to the path and use

    git push

to push them to a remote.

์˜ˆ์ œ์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋Š” ๋Œ€๋กœ ์ด๋Ÿฌํ•œ ์ƒํ™ฉ์—์„œ ๋‹ค์Œ์œผ๋กœ ๋ฌด์—‡์„ ํ•ด์•ผ ํ•˜๋Š”์ง€ Git์€ ๋„์›€์„ ์ค€๋‹ค. ๊ฐ€์žฅ ๋‹จ์ˆœํ•œ ๋ฐฉ๋ฒ•์€ ๊ฐ ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๊ฐ€์„œ ์ง์ ‘ ์ผ์ผ์ด Push๋ฅผ ํ•ด์„œ ์™ธ๋ถ€๋กœ ๊ณต์œ ํ•˜๊ณ  ๋‚˜์„œ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋ฅผ Push ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์ด ์˜ต์…˜์ด ํ•ญ์ƒ ์ ์šฉ๋˜๋„๋ก ํ•˜๊ณ  ์‹ถ์œผ๋ฉด git config push.recurseSubmodules check ๋ช…๋ น์œผ๋กœ ์„ค์ •ํ•œ๋‹ค.

์˜ต์…˜์œผ๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ๋‹ค๋ฅธ ๊ฐ’์œผ๋กœ โ€œon-demandโ€ ๊ฐ’์ด ์žˆ๋Š”๋ฐ, ์ด ๊ฐ’์œผ๋กœ ์„ค์ •ํ•˜๋ฉด Git์ด Push๋ฅผ ๋Œ€์‹  ์‹œ๋„ํ•œ๋‹ค.

$ git push --recurse-submodules=on-demand
Pushing submodule 'DbConnector'
Counting objects: 9, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 917 bytes | 0 bytes/s, done.
Total 9 (delta 3), reused 0 (delta 0)
To https://github.com/chaconinc/DbConnector
   c75e92a..82d2ad3  stable -> stable
Counting objects: 2, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 266 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
To https://github.com/chaconinc/MainProject
   3d6d338..9a377d1  master -> master

์œ„์—์„œ ๋ณด๋“ฏ์ด Git์ด ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋ฅผ Push ํ•˜๊ธฐ ์ „์— DbConnector ๋ชจ๋“ˆ๋กœ ๋“ค์–ด๊ฐ€์„œ Push๋ฅผ ํ•œ๋‹ค. ๋ชจ์ข…์˜ ์ด์œ ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ Push์— ์‹คํŒจํ•œ๋‹ค๋ฉด ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์˜ Push ๋˜ํ•œ ์‹คํŒจํ•˜๊ฒŒ ๋œ๋‹ค. git config push.recurseSubmodules on-demand ๋ช…๋ น์œผ๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ Merge ํ•˜๊ธฐ

๋‹ค๋ฅธ ๋ˆ„๊ตฐ๊ฐ€์™€ ๋™์‹œ์— ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ˆ˜์ •ํ•˜๋ฉด ๋ช‡ ๊ฐ€์ง€ ๋ฌธ์ œ์— ๋ด‰์ฐฉํ•˜๊ฒŒ ๋œ๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ํžˆ์Šคํ† ๋ฆฌ๊ฐ€ ๊ฐˆ๋ผ์ ธ์„œ ์ƒ์œ„ ํ”„๋กœ์ ํŠธ์— ์ปค๋ฐ‹ํ–ˆ๋‹ค๋ฉด ์‚ฌํƒœ๋ฅผ ๋ฐ”๋กœ์žก์•„์•ผ ํ•œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ปค๋ฐ‹ ๋‘ ๊ฐœ๋ฅผ ๋น„๊ตํ–ˆ์„ ๋•Œ Fast-Forward Merge๊ฐ€ ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ Git์€ ๋‹จ์ˆœํžˆ ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹์„ ์„ ํƒํ•œ๋‹ค.

ํ•˜์ง€๋งŒ, Fast-Forward๊ฐ€ ๊ฐ€๋Šฅํ•˜์ง€ ์•Š์œผ๋ฉด Git์€ ์ถฉ๋Œ ์—†์ด Trivial Merge(Merge ์ปค๋ฐ‹์„ ๋‚จ๊ธฐ๋Š” Merge)๋ฅผ ํ•  ์ˆ˜ ์žˆ๋‹ค ํ•ด๋„ Merge ํ•˜์ง€ ์•Š๋Š”๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ ์ปค๋ฐ‹๋“ค์ด ๋ถ„๊ธฐ๋๋‹ค๊ฐ€ Merge ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ ์•„๋ž˜์™€ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ๋ณด๊ฒŒ ๋œ๋‹ค.

$ git pull
remote: Counting objects: 2, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 2 (delta 1), reused 2 (delta 1)
Unpacking objects: 100% (2/2), done.
From https://github.com/chaconinc/MainProject
   9a377d1..eb974f8  master     -> origin/master
Fetching submodule DbConnector
warning: Failed to merge submodule DbConnector (merge following commits not found)
Auto-merging DbConnector
CONFLICT (submodule): Merge conflict in DbConnector
Automatic merge failed; fix conflicts and then commit the result.

์œ„ ๊ฒฐ๊ณผ๋ฅผ ํ†ตํ•ด ํ˜„์žฌ ์ƒํƒœ๋ฅผ ์‚ดํŽด๋ณธ๋‹ค๋ฉด Git์€ ๋ถ„๊ธฐ๋œ ๋‘ ํžˆ์Šคํ† ๋ฆฌ ๋ธŒ๋žœ์น˜๋ฅผ ์ฐพ์•˜๊ณ  Merge๊ฐ€ ํ•„์š”ํ•˜๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋œ๋‹ค. ์ด ์ƒํ™ฉ์€ โ€œmerge following commits not foundโ€(Merge ์ปค๋ฐ‹์„ ์ฐพ์„ ์ˆ˜ ์—†์Œ)๋ผ๋Š” ๋ฉ”์‹œ์ง€๋กœ ํ‘œํ˜„ํ•˜๋Š”๋ฐ, ์˜๋ฏธ๊ฐ€ ์ข€ ์ด์ƒํ•˜์ง€๋งŒ ์™œ ๊ทธ๋Ÿฐ์ง€๋Š” ์ด์–ด์ง€๋Š” ๋‚ด์šฉ์œผ๋กœ ์„ค๋ช…ํ•œ๋‹ค.

์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์„œ๋ธŒ๋ชจ๋“ˆ์ด ์–ด๋–ค ์ƒํƒœ์—ฌ์•ผ ํ•˜๋Š”์ง€ ์•Œ์•„์•ผ ํ•œ๋‹ค. ์ด์ƒํ•˜๊ฒŒ๋„ Git์€ ์ด๋ฅผ ์œ„ํ•œ ์ •๋ณด๋ฅผ ์ถฉ๋ถ„ํžˆ ์ฃผ์ง€ ์•Š๋Š”๋‹ค. ์–‘์ชฝ ํžˆ์Šคํ† ๋ฆฌ์— ์žˆ๋Š” ์ปค๋ฐ‹์˜ SHA๋„ ์•Œ๋ ค์ฃผ์ง€ ์•Š๋Š”๋‹ค. ๊ทธ๋ž˜๋„ ์•Œ์•„๋‚ด๋Š” ๊ฑด ๊ฐ„๋‹จํ•˜๋‹ค. git diff ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด Merge ํ•˜๋ ค๋Š” ์–‘์ชฝ ๋ธŒ๋žœ์น˜์— ๋‹ด๊ธด ์ปค๋ฐ‹์˜ SHA๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

$ git diff
diff --cc DbConnector
index eb41d76,c771610..0000000
--- a/DbConnector
+++ b/DbConnector

์œ„ ๊ฐ™์€ ๊ฒฝ์šฐ eb41d76 ์ด ๋กœ์ปฌ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ปค๋ฐ‹์ด๊ณ  c771610 ์ด Upstream์— ์žˆ๋Š” ์ปค๋ฐ‹์ด๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๊ฐ€๋ฉด ํ˜„์žฌ eb41d76 ์ปค๋ฐ‹์„ ๊ฐ€๋ฆฌํ‚ค๊ณ  ์žˆ๊ณ  Merge ์ž‘์—…์€ ์•„์ง ์ด๋ฃจ์–ด์ง€์ง€ ์•Š์•˜๋‹ค. ์ด ์ƒํƒœ์—์„œ ํ˜„์žฌ eb41d76 ์ปค๋ฐ‹์„ ๋ธŒ๋žœ์น˜๋กœ ๋งŒ๋“ค์–ด Merge ์ž‘์—…์„ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

์ค‘์š”ํ•œ ๊ฑด ๋‹ค๋ฅธ ์ชฝ ์ปค๋ฐ‹์˜ SHA์ด๋‹ค. ์ด์ชฝ์ด Merge ํ•ด์•ผ ํ•  ๋Œ€์ƒ์ด๋‹ค. SHA ํ•ด์‹œ ๊ฐ’์„ ๋ช…์‹œํ•˜์—ฌ ๊ณง๋ฐ”๋กœ Merge ํ•  ์ˆ˜๋„ ์žˆ๊ณ  ๋Œ€์ƒ์ด ๋˜๋Š” ์ปค๋ฐ‹์„ ์ƒˆ๋กœ ๋ธŒ๋žœ์น˜๋กœ ํ•˜๋‚˜ ๋งŒ๋“ค์–ด Merge ํ•  ์ˆ˜๋„ ์žˆ๋‹ค. ๋” ๋ฉ‹์ง„ Merge ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€๋ฅผ ์œ„ํ•ด์„œ๋ผ๋„ ํ›„์ž๋ฅผ ์ถ”์ฒœํ•œ๋‹ค.

๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•ด์„œ git diff ์—์„œ ๋‚˜์˜จ ๋‘ ๋ฒˆ์งธ SHA๋ฅผ ๋ธŒ๋žœ์น˜๋กœ ๋งŒ๋“ค๊ณ  ์ง์ ‘ Merge ํ•œ๋‹ค.

$ cd DbConnector

$ git rev-parse HEAD
eb41d764bccf88be77aced643c13a7fa86714135

$ git branch try-merge c771610
(DbConnector) $ git merge try-merge
Auto-merging src/main.c
CONFLICT (content): Merge conflict in src/main.c
Recorded preimage for 'src/main.c'
Automatic merge failed; fix conflicts and then commit the result.

์‹ค์ œ Merge ์‹œ ์ถฉ๋Œ์ด ์ผ์–ด๋‚ฌ๊ณ  ํ•ด๊ฒฐํ•œ ๋‹ค์Œ ์ปค๋ฐ‹ํ–ˆ๋‹ค. ์ดํ›„ Merge ํ•œ ์„œ๋ธŒ๋ชจ๋“ˆ ๊ฒฐ๊ณผ๋กœ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•œ๋‹ค.

$ vim src/main.c (1)
$ git add src/main.c
$ git commit -am 'merged our changes'
Recorded resolution for 'src/main.c'.
[master 9fd905e] merged our changes

$ cd .. (2)
$ git diff (3)
diff --cc DbConnector
index eb41d76,c771610..0000000
--- a/DbConnector
+++ b/DbConnector
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit eb41d764bccf88be77aced643c13a7fa86714135
 -Subproject commit c77161012afbbe1f58b5053316ead08f4b7e6d1d
++Subproject commit 9fd905e5d7f45a0d4cbc43d1ee550f16a30e825a
$ git add DbConnector (4)

$ git commit -m "Merge Tom's Changes" (5)
[master 10d2c60] Merge Tom's Changes
  1. ๋จผ์ € ์ถฉ๋Œ์„ ํ•ด๊ฒฐํ–ˆ๋‹ค

  2. ๊ทธ๋ฆฌ๊ณ  ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋กœ ๋Œ์•„๊ฐ„๋‹ค.

  3. SHA-1๋ฅผ ๋‹ค์‹œ ๊ฒ€์‚ฌํ•˜๊ณ 

  4. ์ถฉ๋Œ ๋‚œ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ํ•ด๊ฒฐํ•œ๋‹ค.

  5. Merge ๊ฒฐ๊ณผ๋ฅผ ์ปค๋ฐ‹ํ•œ๋‹ค.

์ข€ ๋”ฐ๋ผ๊ฐ€๊ธฐ ์–ด๋ ค์šธ ์ˆ˜ ์žˆ์ง€๋งŒ, ์‚ฌ์‹ค ๊ทธ๋ ‡๊ฒŒ ์–ด๋ ค์šด ๊ฑด ์•„๋‹ˆ๋‹ค.

Git์œผ๋กœ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ํฅ๋ฏธ๋กœ์šด ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค. ์œ„์—์„œ ์ฐพ์€ ๋‘ ์ปค๋ฐ‹์„ Merge ํ•œ Merge ์ปค๋ฐ‹์ด ์„œ๋ธŒ๋ชจ๋“ˆ ์ €์žฅ์†Œ์— ์กด์žฌํ•˜๋ฉด Git์€ ์ด Merge ์ปค๋ฐ‹์„ ๊ฐ€๋Šฅํ•œ ํ•ด๊ฒฐ์ฑ…์œผ๋กœ ๋‚ด๋†“๋Š”๋‹ค. ๋ˆ„๊ตฐ๊ฐ€ ์ด๋ฏธ ์ด ๋‘ ์ปค๋ฐ‹์„ Merge ํ•œ ๊ธฐ๋ก์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— Git์€ ์ด Merge ์ปค๋ฐ‹์„ ์ œ์•ˆํ•œ๋‹ค.

์ด๋Ÿฐ ์ด์œ ์—์„œ ์œ„์—์„œ ๋ณธ Merge ํ•  ์ˆ˜ ์—†๋‹ค๋Š” ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๊ฐ€ โ€œmerge following commits not foundโ€ (Merge ์ปค๋ฐ‹์„ ์ฐพ์„ ์ˆ˜ ์—†์Œ) ์ธ ๊ฒƒ์ด๋‹ค. ์ด๋Ÿฐ ๋ฉ”์‹œ์ง€๊ฐ€ ์ด์ƒํ•œ ๊นŒ๋‹ญ์€ ๋ˆ„๊ฐ€ ์ด๋Ÿฐ ์ผ์„ ํ•œ๋‹ค๊ณ  ์ƒ์ƒ์ด๋‚˜ ํ–ˆ๊ฒ ๋Š๋ƒ๋Š” ๋ง์ด๋‹ค.

์œ„์˜ ์ƒํ™ฉ์—์„œ ๋งˆ๋•…ํ•œ Merge ์ปค๋ฐ‹์„ ํ•˜๋‚˜ ๋ฐœ๊ฒฌํ–ˆ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

$ git merge origin/master
warning: Failed to merge submodule DbConnector (not fast-forward)
Found a possible merge resolution for the submodule:
 9fd905e5d7f45a0d4cbc43d1ee550f16a30e825a: > merged our changes
If this is correct simply add it to the index for example
by using:

  git update-index --cacheinfo 160000 9fd905e5d7f45a0d4cbc43d1ee550f16a30e825a "DbConnector"

which will accept this suggestion.
Auto-merging DbConnector
CONFLICT (submodule): Merge conflict in DbConnector
Automatic merge failed; fix conflicts and then commit the result.

Git์ด ์ œ์‹œํ•œ ํ•ด๊ฒฐ์ฑ…์€ ๋งˆ์น˜ git add ํ•œ ๊ฒƒ์ฒ˜๋Ÿผ ํ˜„์žฌ Index๋ฅผ ์—…๋ฐ์ดํŠธํ•ด์„œ ์ถฉ๋Œ ์ƒํ™ฉ์„ ํ•ด๊ฒฐํ•˜๊ณ  ์ปค๋ฐ‹ํ•˜๋ผ๋Š” ๊ฒƒ์ด๋‹ค. ๋ฌผ๋ก  ์ œ์‹œํ•œ ํ•ด๊ฒฐ์ฑ…์„ ๋”ฐ๋ฅด์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•ด์„œ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ง์ ‘ ํ™•์ธํ•˜๊ณ  Fast-forward Merge๋ฅผ ํ•œ ํ›„ Test ํ•ด๋ณด๊ณ  ์ปค๋ฐ‹ํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

$ cd DbConnector/
$ git merge 9fd905e
Updating eb41d76..9fd905e
Fast-forward

$ cd ..
$ git add DbConnector
$ git commit -am 'Fast forwarded to a common submodule child'

์œ„์™€ ๊ฐ™์€ ๋ช…๋ น์œผ๋กœ๋„ ๊ฐ™์€ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜๋ฉด Merge ์ปค๋ฐ‹์— ํ•ด๋‹นํ•˜๋Š” ์ฝ”๋“œ๋กœ ํ…Œ์ŠคํŠธ๊นŒ์ง€ ํ•ด ๋ณผ ์ˆ˜ ์žˆ์œผ๋ฉฐ, Merge ์ž‘์—… ํ›„์— ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ํ•ด๋‹น ์ฝ”๋“œ๋กœ ์—…๋ฐ์ดํŠธ๋œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ํŒ

์„œ๋ธŒ๋ชจ๋“ˆ ์ž‘์—…์„ ๋„์™€์ค„ ๋ช‡ ๊ฐ€์ง€ ํŒ์„ ์†Œ๊ฐœํ•œ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ Foreach ์—ฌํ–‰

foreach ๋ผ๋Š” ์„œ๋ธŒ๋ชจ๋“ˆ ๋ช…๋ น์ด ์žˆ์–ด ํ•œ ๋ฒˆ์— ๊ฐ ์„œ๋ธŒ๋ชจ๋“ˆ์— Git ๋ช…๋ น์„ ๋‚ด๋ฆด ์ˆ˜ ์žˆ๋‹ค. ํ•œ ํ”„๋กœ์ ํŠธ ์•ˆ์— ๋‹ค์ˆ˜์˜ ์„œ๋ธŒ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ๊ฐ€ ํฌํ•จ๋œ ๊ฒฝ์šฐ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด ์—ฌ๋Ÿฌ ์„œ๋ธŒ๋ชจ๋“ˆ์— ๊ฑธ์ณ ์ž‘์—…ํ•˜๋˜ ๋„์ค‘์— ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ๋ฒ„๊ทธ ์ˆ˜์ •์„ ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๋‹ค. ๊ฐ„๋‹จํžˆ ์•„๋ž˜์™€ ๊ฐ™์€ ๋ช…๋ น์œผ๋กœ ํ•œ๊บผ๋ฒˆ์— ๋ชจ๋“  ์„œ๋ธŒ๋ชจ๋“ˆ์— Stash ๋ช…๋ น์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

$ git submodule foreach 'git stash'
Entering 'CryptoLibrary'
No local changes to save
Entering 'DbConnector'
Saved working directory and index state WIP on stable: 82d2ad3 Merge from origin/stable
HEAD is now at 82d2ad3 Merge from origin/stable

์œ„์™€ ๊ฐ™์ด ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๊ณ  ๋‚˜๋ฉด ๋ชจ๋“  ์„œ๋ธŒ๋ชจ๋“ˆ๊ณผ ํ•จ๊ป˜ ์ƒˆ ๋ธŒ๋žœ์น˜๋กœ ์ด๋™ํ•ด์„œ ์ž‘์—…ํ•  ์ค€๋น„๋ฅผ ๋งˆ์น˜๊ฒŒ ๋œ๋‹ค.

$ git submodule foreach 'git checkout -b featureA'
Entering 'CryptoLibrary'
Switched to a new branch 'featureA'
Entering 'DbConnector'
Switched to a new branch 'featureA'

๊ฐ์ด ์žกํžˆ๋Š”๊ฐ€? ์ด ๋ช…๋ น์„ ์œ ์šฉํ•œ ๊ฒฝ์šฐ๋Š” ์„œ๋ธŒ๋ชจ๋“ˆ์„ ํฌํ•จํ•œ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์˜ ์ „์ฒด diff ๋‚ด์šฉ์„ ํ•œ๊บผ๋ฒˆ์— ๊ฒฐ๊ณผ๋กœ ์–ป๊ณ ์ž ํ•˜๋Š” ๊ฒฝ์šฐ์ด๋‹ค.

$ git diff; git submodule foreach 'git diff'
Submodule DbConnector contains modified content
diff --git a/src/main.c b/src/main.c
index 210f1ae..1f0acdc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -245,6 +245,8 @@ static int handle_alias(int *argcp, const char ***argv)

      commit_pager_choice();

+     url = url_decode(url_orig);
+
      /* build alias_argv */
      alias_argv = xmalloc(sizeof(*alias_argv) * (argc + 1));
      alias_argv[0] = alias_string + 1;
Entering 'DbConnector'
diff --git a/src/db.c b/src/db.c
index 1aaefb6..5297645 100644
--- a/src/db.c
+++ b/src/db.c
@@ -93,6 +93,11 @@ char *url_decode_mem(const char *url, int len)
        return url_decode_internal(&url, len, NULL, &out, 0);
 }

+char *url_decode(const char *url)
+{
+       return url_decode_mem(url, strlen(url));
+}
+
 char *url_decode_parameter_name(const char **query)
 {
        struct strbuf out = STRBUF_INIT;

์œ„์˜ ๊ฒฐ๊ณผ๋กœ ์•Œ ์ˆ˜ ์žˆ๋Š” ๋‚ด์šฉ์€ ์„œ๋ธŒ๋ชจ๋“ˆ์—์„œ ์ƒˆ ํ•จ์ˆ˜๋ฅผ ์ถ”๊ฐ€ํ–ˆ๊ณ  ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์—์„œ ์ถ”๊ฐ€ํ•œ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค๋Š” ๋‚ด์šฉ์ด๋‹ค. ์˜ˆ์ œ๋กœ ์‚ดํŽด๋ณธ ๋‚ด์šฉ์€ ์•„์ฃผ ๋‹จ์ˆœํ•œ ์˜ˆ์‹œ์ผ ๋ฟ์ด์ง€๋งŒ ์–ด๋–ป๊ฒŒ foreach ๋ช…๋ น์„ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๋Š”์ง€ ๊ฐ ์žก์„ ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋‹ค.

์œ ์šฉํ•œ Alias

์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ด์šฉํ•˜๋Š” ๋ช…๋ น์€ ๋Œ€๋ถ€๋ถ„ ๊ธธ์ด๊ฐ€ ๊ธธ์–ด์„œ Alias๋ฅผ ๋งŒ๋“ค์–ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ํŽธํ•˜๋‹ค. ํ˜น์€ ์„ค์ •ํŒŒ์ผ์„ ํ†ตํ•ด ๊ธฐ๋ณธ ๊ฐ’์œผ๋กœ ๋ชจ๋“  ๋ช…๋ น์— ์„ค์ •ํ•˜์ง€ ์•Š๊ณ  ์‰ฝ๊ฒŒ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•  ๋•Œ๋„ Alias๋Š” ์œ ์šฉํ•˜๋‹ค. Alias๋ฅผ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ch02-git-basics-chapter.asc์—์„œ ์ด๋ฏธ ๋‹ค๋ฃจ์—ˆ๋‹ค. ์—ฌ๊ธฐ์—์„œ๋Š” ์„œ๋ธŒ๋ชจ๋“ˆ์— ๊ด€๋ จ๋œ ๋ช‡ ๊ฐ€์ง€ ์œ ์šฉํ•œ Alias๋งŒ ์‚ดํŽด๋ณธ๋‹ค.

$ git config alias.sdiff '!'"git diff && git submodule foreach 'git diff'"
$ git config alias.spush 'push --recurse-submodules=on-demand'
$ git config alias.supdate 'submodule update --remote --merge'

์œ„์™€ ๊ฐ™์ด ์„ค์ •ํ•˜๋ฉด git supdate ๋ช…๋ น์œผ๋กœ ๊ฐ„๋‹จํžˆ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์—…๋ฐ์ดํŠธํ•  ์ˆ˜ ์žˆ๊ณ  git spush ๋ช…๋ น์œผ๋กœ ๊ฐ„๋‹จํžˆ ์„œ๋ธŒ๋ชจ๋“ˆ๋„ ์—…๋ฐ์ดํŠธ๊ฐ€ ํ•„์š”ํ•œ์ง€ ํ™•์ธํ•˜๋ฉฐ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ๋ฅผ Push ํ•  ์ˆ˜ ์žˆ๋‹ค.

์„œ๋ธŒ๋ชจ๋“ˆ ์‚ฌ์šฉํ•  ๋•Œ ์ฃผ์˜ํ•  ์ ๋“ค

์ „์ฒด์ ์œผ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์€ ์–ด๋ ต์ง€ ์•Š๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ์ฃผ์˜ํ•ด์•ผ ํ•œ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด Checkout์œผ๋กœ ๋ธŒ๋žœ์น˜๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒฝ์šฐ ์„œ๋ธŒ๋ชจ๋“ˆ์ด ํฌํ•จ๋œ ์ž‘์—…์ด๋ผ๋ฉด ์ข€ ์• ๋งคํ•˜๊ฒŒ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์—์„œ ์ƒˆ ๋ธŒ๋žœ์น˜๋ฅผ ์ƒ์„ฑํ•˜๊ณ  Checkout ํ•œ ํ›„ ์ƒˆ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ•œ๋‹ค. ์ดํ›„ ๋‹ค์‹œ ์ด์ „ ๋ธŒ๋žœ์น˜๋กœ Checkout ํ•˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋Š” ์ถ”์ ํ•˜์ง€ ์•Š๋Š” ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๋‚จ๊ฒŒ ๋œ๋‹ค.

$ git checkout -b add-crypto
Switched to a new branch 'add-crypto'

$ git submodule add https://github.com/chaconinc/CryptoLibrary
Cloning into 'CryptoLibrary'...
...

$ git commit -am 'adding crypto library'
[add-crypto 4445836] adding crypto library
 2 files changed, 4 insertions(+)
 create mode 160000 CryptoLibrary

$ git checkout master
warning: unable to rmdir CryptoLibrary: Directory not empty
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    CryptoLibrary/

nothing added to commit but untracked files present (use "git add" to track)

๋ฌผ๋ก  ์ถ”์ ํ•˜์ง€ ์•Š๋Š” ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ง€์šฐ๋Š” ๊ฑด ์‰ฝ๋‹ค. ์ด๋ ‡๊ฒŒ ์ˆ˜๋™์œผ๋กœ ์ง€์›Œ์•ผ ํ•œ๋‹ค๋Š” ๊ฒŒ ์ด์ƒํ•œ ๊ฒƒ์ด๋‹ค. ์ˆ˜๋™์œผ๋กœ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ง€์šฐ๊ณ  ๋‹ค์‹œ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ–ˆ๋˜ ๋ธŒ๋žœ์น˜๋กœ Checkout ํ•˜๋ฉด submodule update --init ๋ช…๋ น์„ ์‹คํ–‰ํ•ด ์ค˜์•ผ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ฝ”๋“œ๊ฐ€ ๋‚˜ํƒ€๋‚œ๋‹ค(์—ญ์ฃผ - ์ด๋ ‡๊ฒŒ ์ฝ”๋“œ๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ  ๋‚˜๋ฉด Detached HEAD๊ฐ€ ๋œ๋‹ค).

$ git clean -ffdx
Removing CryptoLibrary/

$ git checkout add-crypto
Switched to branch 'add-crypto'

$ ls CryptoLibrary/

$ git submodule update --init
Submodule path 'CryptoLibrary': checked out 'b8dda6aa182ea4464f3f3264b11e0268545172af'

$ ls CryptoLibrary/
Makefile	includes	scripts		src

๋ช…๋ น์ด ์–ด๋ ค์šด ๊ฑด ์•„๋‹ˆ์ง€๋งŒ, ๋‹ค์‹œ ๋ด๋„ ์ด์ƒํ•˜๋‹ค.

๋˜ ํ•˜๋‚˜ ์ฃผ์˜ ๊นŠ๊ฒŒ ์‚ดํŽด๋ณผ ์ผ์€ ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์„œ๋ธŒ๋ชจ๋“ˆ๋กœ ๊ต์ฒดํ•˜๋ฉด์„œ ๋ธŒ๋žœ์น˜๊ฐ„ ์ด๋™ํ•˜๋Š” ๊ฒฝ์šฐ์ด๋‹ค. ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์—์„œ ๊ด€๋ฆฌํ•˜๋˜ ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒˆ ์„œ๋ธŒ๋ชจ๋“ˆ๋กœ ๊ต์ฒดํ•  ๋•Œ ์ฃผ์˜๋ฅผ ๊ธฐ์šธ์ด์ง€ ์•Š์œผ๋ฉด Git์„ ์ง‘์–ด๋˜์ง€๊ณ  ์‹ถ๊ฒŒ ๋œ๋‹ค. ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์„œ๋ธŒ๋ชจ๋“ˆ๋กœ ๊ต์ฒดํ•˜๋Š” ์ƒํ™ฉ์„ ์‚ดํŽด๋ณด์ž. ์šฐ์„  ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ทธ๋ƒฅ ์ง€์šฐ๊ณ  ๋ฐ”๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ•œ๋‹ค๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋‚˜ํƒ€๋‚œ๋‹ค.

$ rm -Rf CryptoLibrary/
$ git submodule add https://github.com/chaconinc/CryptoLibrary
'CryptoLibrary' already exists in the index

์œ„์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๋ฅผ ํ•ด๊ฒฐํ•˜๋ ค๋ฉด ์šฐ์„  CryptoLibrary ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ด€๋ฆฌ๋Œ€์ƒ์—์„œ ์‚ญ์ œํ•˜๊ณ  ๋‚˜์„œ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ•œ๋‹ค.

$ git rm -r CryptoLibrary
$ git submodule add https://github.com/chaconinc/CryptoLibrary
Cloning into 'CryptoLibrary'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 11 (delta 0), reused 11 (delta 0)
Unpacking objects: 100% (11/11), done.
Checking connectivity... done.

์œ„์˜ ์ž‘์—…์„ master๊ฐ€ ์•„๋‹Œ ์–ด๋–ค ๋ธŒ๋žœ์น˜์—์„œ ์‹คํ–‰ํ•œ ์ƒํ™ฉ์ด๋‹ค. ๋งŒ์•ฝ ๋‹ค์‹œ master ๋ธŒ๋žœ์น˜๋กœ Checkout ํ•˜๊ฒŒ ๋˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ์ด ์•„๋‹ˆ๋ผ ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์กด์žฌํ•ด์•ผ ํ•˜๋Š” ์ƒํ™ฉ์ด ๋˜๋Š”๋ฐ, ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋œ๋‹ค.

$ git checkout master
error: The following untracked working tree files would be overwritten by checkout:
  CryptoLibrary/Makefile
  CryptoLibrary/includes/crypto.h
  ...
Please move or remove them before you can switch branches.
Aborting

๋ฌผ๋ก  checkout -f ์˜ต์…˜์„ ๋ถ™์—ฌ์„œ ๊ฐ•์ œ๋กœ ๋ธŒ๋žœ์น˜๋ฅผ Checkout ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ์„œ๋ธŒ๋ชจ๋“ˆ์—์„œ ์ €์žฅํ•˜์ง€ ์•Š์€ ๋‚ด์šฉ์„ ๋˜๋Œ๋ฆด ์ˆ˜ ์—†๊ฒŒ ๋ฎ์–ด์“ฐ๊ธฐ ๋•Œ๋ฌธ์— ์ฃผ์˜ ๊นŠ๊ฒŒ ๊ฐ•์ œ ์ ์šฉ ์˜ต์…˜์„ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

$ git checkout -f master
warning: unable to rmdir CryptoLibrary: Directory not empty
Switched to branch 'master'

ํ›„์— ๋‹ค์‹œ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ถ”๊ฐ€ํ–ˆ๋˜ ๋ธŒ๋žœ์น˜๋กœ Checkout ํ•˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ CryptoLibrary ๋Š” ๋น„์–ด ์žˆ๋‹ค. ๊ฐ„ํ˜น git submodule update ๋ช…๋ น์œผ๋กœ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์ดˆ๊ธฐํ™”ํ•˜๋”๋ผ๋„ ์„œ๋ธŒ๋ชจ๋“ˆ ์ฝ”๋“œ๊ฐ€ ์‚ด์•„๋‚˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ๋‹ค. ์ด๋Ÿด ๋•Œ๋Š” ์„œ๋ธŒ๋ชจ๋“ˆ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•ด์„œ git checkout . ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ์„œ๋ธŒ๋ชจ๋“ˆ ์ฝ”๋“œ๊ฐ€ ๋‚˜ํƒ€๋‚œ๋‹ค. ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์—ฌ๋Ÿฌ ๊ฐœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ submodule foreach ๋ช…๋ น์œผ๋กœ ํ•œ๊บผ๋ฒˆ์— ์ฝ”๋“œ๋ฅผ ๋ณต๊ตฌํ•  ์ˆ˜ ์žˆ๋‹ค.

์ตœ์‹  ๋ฒ„์ „์˜ Git์€ ์„œ๋ธŒ๋ชจ๋“ˆ์˜ ์ปค๋ฐ‹ ๋ฐ์ดํ„ฐ๋„ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์˜ .git ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๊ด€๋ฆฌํ•œ๋‹ค. ์˜ˆ์ „ ๋ฒ„์ „์˜ Git๊ณผ ๋‹ฌ๋ฆฌ ์„œ๋ธŒ๋ชจ๋“ˆ์ด ํฌํ•จ๋œ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๋ง๊ฐ€๋œจ๋ ธ๋‹ค ํ•˜๋”๋ผ๋„ ๊ธฐ๋กํ•ด ๋‘” ์ปค๋ฐ‹ ๋ฐ์ดํ„ฐ๋Š” ์‰ฝ๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค.

์ด๋Ÿฐ ์—ฌ๋Ÿฌ ๋„๊ตฌ์™€ ํ•จ๊ป˜ ์„œ๋ธŒ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ๊ฐ„๋‹จํ•˜๊ณ  ํšจ์œจ์ ์œผ๋กœ ๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์™€ ํ•˜์œ„ ํ”„๋กœ์ ํŠธ๋ฅผ ๋™์‹œ์— ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค.