{"id":7208,"date":"2026-10-02T15:31:14","date_gmt":"2026-10-02T20:31:14","guid":{"rendered":"https:\/\/ykim.synology.me\/wordpress\/monorepo-subfolder-export-convention-publishing-one-folder-as-a-history-free-snapshot-7208\/"},"modified":"2026-10-02T15:31:59","modified_gmt":"2026-10-02T20:31:59","slug":"monorepo-subfolder-export-convention-publishing-one-folder-as-a-history-free-snapshot","status":"publish","type":"post","link":"https:\/\/ykim.synology.me\/wordpress\/monorepo-subfolder-export-convention-publishing-one-folder-as-a-history-free-snapshot-7208\/","title":{"rendered":"Monorepo Subfolder Export Convention \u2014 Publishing One Folder as a History-Free Snapshot"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/github.com\/yBarn1\/Images\/blob\/main\/produce\/yellow-lemons-produce-bin.jpg?raw=true\" alt=\"\" style=\"width:auto;height:500px\"\/><\/figure>\n\n\n<p><div class=\"github-readme-container markdown-body\"><div id=\"file\" class=\"md\" data-path=\"GitHub\/monorepo-subfolder-export-convention-ko.md\"><article class=\"markdown-body entry-content container-lg\" itemprop=\"text\"><div class=\"markdown-heading\" dir=\"auto\"><h1 class=\"heading-element\" dir=\"auto\">Monorepo Subfolder Export Convention \u2014 Publishing One Folder as a History-Free Snapshot<\/h1><a id=\"user-content-monorepo-subfolder-export-convention--publishing-one-folder-as-a-history-free-snapshot\" class=\"anchor\" aria-label=\"Permalink: Monorepo Subfolder Export Convention \u2014 Publishing One Folder as a History-Free Snapshot\" href=\"#monorepo-subfolder-export-convention--publishing-one-folder-as-a-history-free-snapshot\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">Rev. 5 | Created: 2026-10-02 | Updated: 2026-10-03 00:02 UTC<\/p>\n<ul dir=\"auto\">\n<li><a href=\"#1-purpose\">1. Purpose<\/a><\/li>\n<li><a href=\"#2-summary\">2. Summary<\/a><\/li>\n<li><a href=\"#3-taxonomy-and-its-hierarchy\">3. Taxonomy and its Hierarchy<\/a>\n<ul dir=\"auto\">\n<li><a href=\"#31-placement\">3.1 Placement<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#4-procedure\">4. Procedure<\/a>\n<ul dir=\"auto\">\n<li><a href=\"#41-prerequisites\">4.1 Prerequisites<\/a><\/li>\n<li><a href=\"#42-choose-the-method\">4.2 Choose the Method<\/a><\/li>\n<li><a href=\"#43-run\">4.3 Run<\/a><\/li>\n<li><a href=\"#44-verify\">4.4 Verify<\/a><\/li>\n<li><a href=\"#45-how-the-commands-work\">4.5 How the Commands Work<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#5-application\">5. Application<\/a><\/li>\n<li><a href=\"#6-further-work\">6. Further Work<\/a><\/li>\n<li><a href=\"#references\">References<\/a><\/li>\n<li><a href=\"#appendix-a-terminology\">Appendix A. Terminology<\/a><\/li>\n<li><a href=\"#appendix-b-reference-implementation\">Appendix B. Reference Implementation<\/a>\n<ul dir=\"auto\">\n<li><a href=\"#b1-orphan-snapshot\">B.1 Orphan Snapshot<\/a><\/li>\n<li><a href=\"#b2-chained-snapshot\">B.2 Chained Snapshot<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">1. Purpose<\/h2><a id=\"user-content-1-purpose\" class=\"anchor\" aria-label=\"Permalink: 1. Purpose\" href=\"#1-purpose\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<ul dir=\"auto\">\n<li><strong>Problem Statement<\/strong>: Git \uc758 push \ub2e8\uc704\ub294 branch \uc774\ubbc0\ub85c monorepo \uc758 \ud558\uc704 folder \ud558\ub098\ub9cc \uace8\ub77c \ub2e4\ub978 remote repository \ub85c \ubcf4\ub0bc \uc218 \uc5c6\uace0, subtree \ub85c \uadf8 folder \ub97c \ub5bc\uc5b4 \ub0b4\uba74 folder \uc758 \uc804 history \uac00 \uc804\uc1a1 \ub300\uc0c1\uc774 \ub418\uc5b4 \ud070 binary file \uc774 \uc313\uc778 folder \uc5d0\uc11c\ub294 \uc804\uc1a1\uc774 \ub05d\ub098\uc9c0 \uc54a\ub294\ub2e4.<\/li>\n<li><strong>Goal<\/strong>: \ud558\uc704 folder \ud558\ub098\uc758 \ud604\uc7ac \ub0b4\uc6a9\ub9cc \ub2e4\ub978 remote \uc758 <code>main<\/code> \uc73c\ub85c \uc62c\ub824 \ubc1b\ub294 \ucabd\uc774 <code>clone<\/code> \ud55c \ubc88\uc73c\ub85c \uadf8 folder \ub97c \uc5bb\uac8c \ud558\uace0, \uc2e4\ubb34\uc790\uac00 \uc774 \ubb38\uc11c\ub9cc\uc73c\ub85c \ubc29\uc2dd\uc744 \uace8\ub77c \uc2e4\ud589\ud558\uace0 \uacb0\uacfc\ub97c \ud655\uc778\ud560 \uc218 \uc788\ub294 user guide \uac00 \ub41c\ub2e4.<\/li>\n<li><strong>Non-Goal<\/strong>: Remote \uc758 \ubcc0\uacbd\uc744 monorepo \ub85c \ub418\ubc1b\ub294 \uc591\ubc29\ud5a5 \ub3d9\uae30\ud654\ub294 \ub2e4\ub8e8\uc9c0 \uc54a\ub294\ub2e4.<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">2. Summary<\/h2><a id=\"user-content-2-summary\" class=\"anchor\" aria-label=\"Permalink: 2. Summary\" href=\"#2-summary\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">\ubc29\uc2dd\uc740 remote \uc758 <code>main<\/code> \uc774 force push \ub97c \ubc1b\ub294\uc9c0\ub85c \uace0\ub978\ub2e4. \ubc1b\uc73c\uba74 orphan snapshot \uc744 \uc4f0\uace0, branch protection \uc73c\ub85c force push \uac00 \ub9c9\ud600 \uc788\uac70\ub098 \uc774\uc804 \ud310\uc744 remote \uc5d0 \ub0a8\uaca8\uc57c \ud558\uba74 chained snapshot \uc744 \uc4f4\ub2e4. \ub450 \ubc29\uc2dd \ubaa8\ub450 script \ud558\ub098\ub97c Windows \uc758 Git Bash \ub098 Linux \uc758 shell \uc5d0\uc11c \uc2e4\ud589\ud558\uba70, GitHub \uc640 Gitea \uc5d0 \uac19\uc740 \ubc29\ubc95\uc73c\ub85c access token \uc744 \uc368\uc11c \uc62c\ub9b0\ub2e4.<\/p>\n<p dir=\"auto\">Orphan snapshot \uc740 \ub0b4\ubcf4\ub0bc folder \uc758 tree \ub97c \uadf8\ub300\ub85c \uac00\ub9ac\ud0a4\ub294 parent \uc5c6\ub294 commit \ud558\ub098\ub97c \ub9cc\ub4e4\uc5b4 remote \uc758 <code>main<\/code> \uc5d0 force push \ud55c\ub2e4. \uc804\uc1a1\ub7c9\uc740 \uadf8 folder \uc758 \ud604\uc7ac file \ud06c\uae30\uc774\uace0 history \ub294 \uc804\uc1a1\ud558\uc9c0 \uc54a\uc73c\ubbc0\ub85c, folder \uc5d0 \uc313\uc778 \uacfc\uac70 \ud310\uc758 \ud06c\uae30\uac00 \uc804\uc1a1 \uc2dc\uac04\uc5d0 \ub4e4\uc5b4\uc624\uc9c0 \uc54a\ub294\ub2e4. \ubc1b\ub294 \ucabd\uc740 remote \ub97c <code>clone<\/code> \ud558\uba74 \uadf8 folder \uc758 \ub0b4\uc6a9\uc774 repository root \uc5d0 \uadf8\ub300\ub85c \ub193\uc778\ub2e4.<\/p>\n<p dir=\"auto\">\ub300\uac00\ub294 \ub450 \uac00\uc9c0\ub2e4. Remote \uc758 <code>main<\/code> \uc774 \uc2e4\ud589\ub9c8\ub2e4 \uc0c8 commit \ud558\ub098\ub85c \ubc14\ub00c\ubbc0\ub85c \uc774\uc804 commit hash \ub294 \ub2ff\uc744 \uc218 \uc5c6\uac8c \ub418\uace0, remote \uc5d0\uc11c monorepo \ub85c \ub418\ubc1b\ub294 \uae38\uc774 \uc5c6\ub2e4. Chained snapshot \uc740 \uac19\uc740 tree \ub97c remote \uc758 \ud604\uc7ac <code>main<\/code> \uc704\uc5d0 \uc774\uc5b4 \uc62c\ub9ac\ubbc0\ub85c force push \uac00 \ud544\uc694 \uc5c6\uace0 \uc774\uc804 commit hash \uac00 \ub0a8\ub294\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">3. Taxonomy and its Hierarchy<\/h2><a id=\"user-content-3-taxonomy-and-its-hierarchy\" class=\"anchor\" aria-label=\"Permalink: 3. Taxonomy and its Hierarchy\" href=\"#3-taxonomy-and-its-hierarchy\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">\ub0b4\ubcf4\ub0b4\uae30 \ubc29\ubc95\uc740 \ubcf4\ub0b4\ub294 \ub2e8\uc704, \ubcf4\ub0b4\ub294 history, \ubc29\ud5a5\uc758 \uc138 \ucd95\uc73c\ub85c \uac08\ub9ac\uba70, \uc804\uc1a1\ub7c9\uc740 history \ucd95\uc774 \uc815\ud55c\ub2e4.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"Unit        repository ----------------------------------- folder\nHistory     full ------ rewritten full ------ snapshot only ------ none\nDirection   two-way ------------------------------------- one-way\n\nrepository + full           + one-way : git push &lt;REMOTE_URL&gt; main\nfolder     + rewritten full + two-way : git subtree push, git subtree pull\nfolder     + rewritten full + one-way : git subtree split, then git push\nfolder     + snapshot only  + one-way : commit-tree with the previous snapshot as parent\nfolder     + none           + one-way : commit-tree with no parent   &lt;- this convention\"><pre lang=\"text\" class=\"notranslate\"><code>Unit        repository ----------------------------------- folder\nHistory     full ------ rewritten full ------ snapshot only ------ none\nDirection   two-way ------------------------------------- one-way\n\nrepository + full           + one-way : git push &lt;REMOTE_URL&gt; main\nfolder     + rewritten full + two-way : git subtree push, git subtree pull\nfolder     + rewritten full + one-way : git subtree split, then git push\nfolder     + snapshot only  + one-way : commit-tree with the previous snapshot as parent\nfolder     + none           + one-way : commit-tree with no parent   &lt;- this convention\n<\/code><\/pre><\/div>\n<p dir=\"auto\">Fig 1. Export axes and the place of each method.<\/p>\n<p dir=\"auto\">Unit \ucd95\uc740 remote \uac00 \ubc1b\ub294 \ubc94\uc704\uc774\uace0, history \ucd95\uc740 \uadf8 \ubc94\uc704\uc758 \uacfc\uac70 \ud310\uc744 \uc5bc\ub9c8\ub098 \ud568\uaed8 \ubcf4\ub0b4\ub294\uc9c0\uc774\uba70, direction \ucd95\uc740 remote \uc758 \ubcc0\uacbd\uc744 \ub418\ubc1b\ub294\uc9c0\uc774\ub2e4. History \ucd95\uc744 \ud55c \ub2e8\uacc4 \ub0b4\ub824\uac00\uba74 \uc804\uc1a1\ub7c9\uc774 \uc904\uace0 \ub0b4\ub824\ub193\ub294 \uac83\uc774 \uc0dd\uae34\ub2e4. <code>full<\/code> \uc5d0\uc11c <code>rewritten full<\/code> \ub85c \ub0b4\ub824\uac00\uba74 monorepo \uc758 \ub2e4\ub978 folder \ub97c \ub0b4\ub824\ub193\uace0, <code>rewritten full<\/code> \uc5d0\uc11c <code>snapshot only<\/code> \ub85c \ub0b4\ub824\uac00\uba74 folder \uc548\uc758 commit \ub2e8\uc704 \uc774\ub825\uc744 \ub0b4\ub824\ub193\uc73c\uba70, <code>snapshot only<\/code> \uc5d0\uc11c <code>none<\/code> \uc73c\ub85c \ub0b4\ub824\uac00\uba74 remote \uc5d0 \uc313\uc778 \uc774\uc804 \ud310\uc744 \ub0b4\ub824\ub193\ub294\ub2e4. \ub418\ubc1b\uae30\ub294 remote \uac00 \ubc1b\uc740 commit \uc774 monorepo \uc758 commit \uacfc \ub300\uc751\ud560 \ub54c\ub9cc \uac00\ub2a5\ud558\ubbc0\ub85c, \uc591\ubc29\ud5a5\uc740 <code>rewritten full<\/code> \uc5d0\uc11c\ub9cc \uc131\ub9bd\ud55c\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">3.1 Placement<\/h3><a id=\"user-content-31-placement\" class=\"anchor\" aria-label=\"Permalink: 3.1 Placement\" href=\"#31-placement\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">Table 1. Export methods by unit, history, and direction<\/p>\n<markdown-accessiblity-table><table>\n<thead>\n<tr>\n<th align=\"center\">Method<\/th>\n<th align=\"center\">Unit<\/th>\n<th align=\"center\">History sent<\/th>\n<th align=\"center\">Direction<\/th>\n<th align=\"center\">Transfer size<\/th>\n<th align=\"center\">When to use<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"center\"><code>git push &lt;REMOTE_URL&gt; main<\/code><\/td>\n<td align=\"center\">Repository \uc804\uccb4<\/td>\n<td align=\"center\">\uc804\ub7c9<\/td>\n<td align=\"center\">\ub2e8\ubc29\ud5a5<\/td>\n<td align=\"center\">Repository \uc758 \uc804 history<\/td>\n<td align=\"center\">Monorepo \ub97c \uadf8 remote \uc5d0 \uadf8\ub300\ub85c \ub450\ub294 \uacbd\uc6b0<\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><code>git subtree push<\/code>, <code>git subtree pull<\/code><\/td>\n<td align=\"center\">Folder \ud558\ub098<\/td>\n<td align=\"center\">\uc7ac\uc791\uc131\ud55c \uc804\ub7c9<\/td>\n<td align=\"center\">\uc591\ubc29\ud5a5<\/td>\n<td align=\"center\">\uadf8 folder \uc758 \uc804 history<\/td>\n<td align=\"center\">\uc678\ubd80 upstream \uc774 \uc788\uc5b4 \ub418\ubc1b\uae30\uac00 \ud544\uc694\ud55c \uacbd\uc6b0<\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><code>git subtree split<\/code>, \uadf8 \ub4a4 <code>git push<\/code><\/td>\n<td align=\"center\">Folder \ud558\ub098<\/td>\n<td align=\"center\">\uc7ac\uc791\uc131\ud55c \uc804\ub7c9<\/td>\n<td align=\"center\">\ub2e8\ubc29\ud5a5<\/td>\n<td align=\"center\">\uadf8 folder \uc758 \uc804 history<\/td>\n<td align=\"center\">\ub0b4\ubcf4\ub0b4\uae30\ub9cc \ud558\ub418 folder \uc758 commit \uc774\ub825\uc744 remote \uc5d0 \ub0a8\uae30\ub294 \uacbd\uc6b0<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Chained snapshot<\/td>\n<td align=\"center\">Folder \ud558\ub098<\/td>\n<td align=\"center\">Snapshot \ub9cc<\/td>\n<td align=\"center\">\ub2e8\ubc29\ud5a5<\/td>\n<td align=\"center\">\uadf8 folder \uc758 \ud604\uc7ac file<\/td>\n<td align=\"center\">\ub0b4\ubcf4\ub0b8 \ud310\uc744 remote \uc5d0 \uc313\ub294 \uacbd\uc6b0<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Orphan snapshot<\/td>\n<td align=\"center\">Folder \ud558\ub098<\/td>\n<td align=\"center\">\uc5c6\uc74c<\/td>\n<td align=\"center\">\ub2e8\ubc29\ud5a5<\/td>\n<td align=\"center\">\uadf8 folder \uc758 \ud604\uc7ac file<\/td>\n<td align=\"center\">\ud604\uc7ac \ub0b4\uc6a9\ub9cc \ubc30\ud3ec\ud558\ub294 \uacbd\uc6b0<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/markdown-accessiblity-table>\n<p dir=\"auto\">\uc774 \uaddc\uc57d\uc740 orphan snapshot \uc744 \uae30\ubcf8\uc73c\ub85c \uc4f0\uace0, remote \uc5d0 \uc774\uc804 \ud310\uc744 \ub0a8\uaca8\uc57c \ud558\uac70\ub098 remote \uc758 <code>main<\/code> \uc774 force push \ub97c \ub9c9\uc744 \ub54c chained snapshot \uc73c\ub85c \ubc14\uafbc\ub2e4. \ub450 subtree \ubc29\ubc95\uc740 folder \uc758 \uc804 history \ub97c \uc804\uc1a1\ud558\ubbc0\ub85c, \uacfc\uac70 \ud310\uc5d0 \ud070 binary file \uc774 \uc313\uc778 folder \uc5d0\uc11c\ub294 \uc804\uc1a1\ub7c9\uc774 \ud604\uc7ac file \ud06c\uae30\uc758 \uba87 \ubc30\uac00 \ub41c\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">4. Procedure<\/h2><a id=\"user-content-4-procedure\" class=\"anchor\" aria-label=\"Permalink: 4. Procedure\" href=\"#4-procedure\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">\uc2e4\ubb34\uc790\ub294 4.1 \uc758 \uc900\ube44\ub97c \ud55c \ubc88 \ub9c8\uce5c \ub4a4, \uc2e4\ud589\ud560 \ub54c\ub9c8\ub2e4 4.3 \uacfc 4.4 \ub97c \ub530\ub978\ub2e4. 4.5 \ub294 script \uac00 \ubb34\uc5c7\uc744 \ud558\ub294\uc9c0 \uc124\uba85\ud55c\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">4.1 Prerequisites<\/h3><a id=\"user-content-41-prerequisites\" class=\"anchor\" aria-label=\"Permalink: 4.1 Prerequisites\" href=\"#41-prerequisites\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<ul dir=\"auto\">\n<li><strong>Git<\/strong> \u2014 Windows \ub294 Git for Windows \ub97c \uc124\uce58\ud558\uace0 script \ub97c \ud568\uaed8 \uc124\uce58\ub418\ub294 Git Bash \uc5d0\uc11c \uc2e4\ud589\ud55c\ub2e4. Linux \ub294 \ubc30\ud3ec\ud310\uc758 <code>git<\/code> package \ub97c \uc4f4\ub2e4.<\/li>\n<li><strong>Remote repository<\/strong> \u2014 GitHub \ub098 Gitea \uc5d0 \ubc1b\ub294 repository \ub97c \ubbf8\ub9ac \ub9cc\ub4e0\ub2e4. \ube44\uc5b4 \uc788\uc5b4\ub3c4 \ub41c\ub2e4.<\/li>\n<li><strong>Access token<\/strong> \u2014 \uadf8 repository \uc5d0 \uc4f0\uae30 \uad8c\ud55c\uc774 \uc788\ub294 access token \uc744 \ubc1c\uae09\ud55c\ub2e4. Push \uac00 username \uacfc password \ub97c \ubb3c\uc73c\uba74 password \uc790\ub9ac\uc5d0 token \uc744 \ub123\ub294\ub2e4.<\/li>\n<li><strong><code>REMOTE_URL<\/code><\/strong> \u2014 HTTPS \uc8fc\uc18c\ub97c \uc4f4\ub2e4. GitHub \ub294 <code>https:\/\/github.com\/&lt;OWNER&gt;\/&lt;REPO&gt;.git<\/code>, Gitea \ub294 <code>https:\/\/&lt;GITEA_HOST&gt;\/&lt;OWNER&gt;\/&lt;REPO&gt;.git<\/code> \uaf34\uc774\ub2e4.<\/li>\n<\/ul>\n<p dir=\"auto\">Token \uc740 <code>REMOTE_URL<\/code> \uc5d0 \ub123\uc9c0 \uc54a\ub294\ub2e4. \uc8fc\uc18c\uc5d0 \ub123\uc740 token \uc740 script file \uacfc shell history \uc5d0 \uadf8\ub300\ub85c \ub0a8\ub294\ub2e4. Windows \uc758 Git for Windows \ub294 credential helper \uac00 token \uc744 \uc800\uc7a5\ud574 \ub2e4\uc74c \uc2e4\ud589\ubd80\ud130 \ubb3b\uc9c0 \uc54a\ub294\ub2e4. Linux \uc5d0\uc11c \ub9e4\ubc88 \ubb3b\uc9c0 \uc54a\uac8c \ud558\ub824\uba74 <code>git config --global credential.helper store<\/code> \ub97c \uc4f0\uba70, \uc774\ub54c token \uc740 <code>~\/.git-credentials<\/code> \uc5d0 \ud3c9\ubb38\uc73c\ub85c \uc800\uc7a5\ub41c\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">4.2 Choose the Method<\/h3><a id=\"user-content-42-choose-the-method\" class=\"anchor\" aria-label=\"Permalink: 4.2 Choose the Method\" href=\"#42-choose-the-method\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">Table 2. Method by remote condition<\/p>\n<markdown-accessiblity-table><table>\n<thead>\n<tr>\n<th align=\"center\">Remote <code>main<\/code> condition<\/th>\n<th align=\"center\">Method<\/th>\n<th align=\"center\">Script<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"center\">Force push \ud5c8\uc6a9, \ud604\uc7ac \ud310\ub9cc \ud544\uc694<\/td>\n<td align=\"center\">Orphan snapshot<\/td>\n<td align=\"center\">B.1<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Branch protection \uc73c\ub85c force push \uae08\uc9c0<\/td>\n<td align=\"center\">Chained snapshot<\/td>\n<td align=\"center\">B.2<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">\uc774\uc804 \ud310\uc744 remote \uc5d0 \ub0a8\uaca8\uc57c \ud568<\/td>\n<td align=\"center\">Chained snapshot<\/td>\n<td align=\"center\">B.2<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/markdown-accessiblity-table>\n<p dir=\"auto\">Branch protection \uc774 \uc9c1\uc811 push \uc790\uccb4\ub97c \ub9c9\uc73c\uba74 \ub450 \ubc29\uc2dd \ubaa8\ub450 \uac70\ubd80\ub418\ubbc0\ub85c, \uadf8 account \uc758 push \ub97c \ud5c8\uc6a9\ud558\ub3c4\ub85d protection \uc124\uc815\uc744 \ubc14\uafd4\uc57c \ud55c\ub2e4. \ubc29\uc2dd\uc740 \ub3c4\uc911\uc5d0 \ubc14\uafc0 \uc218 \uc788\ub2e4. Orphan \uc5d0\uc11c chained \ub85c \ubc14\uafb8\uba74 B.2 \uac00 remote \uc758 orphan commit \uc744 parent \ub85c \ub450\uace0 \uc774\uc5b4 \uc62c\ub9b0\ub2e4. Chained \uc5d0\uc11c orphan \uc73c\ub85c \ubc14\uafb8\uba74 B.1 \uc758 force push \uac00 \uc313\uc778 snapshot \uc744 \ubaa8\ub450 \ub2ff\uc744 \uc218 \uc5c6\uac8c \ub9cc\ub4e0\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">4.3 Run<\/h3><a id=\"user-content-43-run\" class=\"anchor\" aria-label=\"Permalink: 4.3 Run\" href=\"#43-run\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<ol dir=\"auto\">\n<li>Table 2 \ub85c \uace0\ub978 script \ub97c Appendix B \uc5d0\uc11c \ubcf5\uc0ac\ud574 monorepo \uc548\uc5d0 file \ub85c \uc800\uc7a5\ud55c\ub2e4 (\uc608: <code>export-snapshot.sh<\/code>).<\/li>\n<li>Script \uba38\ub9ac\uc758 <code>REMOTE_URL<\/code>, <code>DIR<\/code>, <code>MESSAGE<\/code> \uc138 \ubcc0\uc218\ub97c \uace0\uce5c\ub2e4.<\/li>\n<li>Linux \uc758 shell \uc774\ub098 Windows \uc758 Git Bash \uc5d0\uc11c <code>bash export-snapshot.sh<\/code> \ub85c \uc2e4\ud589\ud55c\ub2e4. Script \uac00 monorepo \uc758 root \ub85c \uc62e\uaca8 \uac00\ubbc0\ub85c, \uc2e4\ud589 \uc704\uce58\ub294 monorepo \uc548\uc774\uba74 \uc5b4\ub514\ub4e0 \ub41c\ub2e4.<\/li>\n<li>\uccab \uc2e4\ud589\uc5d0\uc11c username \uacfc password \ub97c \ubb3c\uc73c\uba74 password \uc790\ub9ac\uc5d0 access token \uc744 \ub123\ub294\ub2e4.<\/li>\n<\/ol>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">4.4 Verify<\/h3><a id=\"user-content-44-verify\" class=\"anchor\" aria-label=\"Permalink: 4.4 Verify\" href=\"#44-verify\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">Script \ub294 \ub9c8\uc9c0\ub9c9 \uc904\uc5d0 \uc62c\ub9b0 commit hash \ub97c \ucd9c\ub825\ud55c\ub2e4. Remote \uc758 <code>main<\/code> \uc774 \uadf8 commit \uc744 \uac00\ub9ac\ud0a4\uba74 \uc131\uacf5\uc774\ub2e4.<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"git ls-remote &lt;REMOTE_URL&gt; main    # Hash must match the commit printed by the script\"><pre>git ls-remote <span class=\"pl-k\">&lt;<\/span>REMOTE_URL<span class=\"pl-k\">&gt;<\/span> main    <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> Hash must match the commit printed by the script<\/span><\/pre><\/div>\n<p dir=\"auto\">\ubc1b\ub294 \ucabd\uc5d0\uc11c <code>git clone &lt;REMOTE_URL&gt;<\/code> \ud558\uba74 <code>&lt;DIR&gt;<\/code> \uc758 \ub0b4\uc6a9\uc774 repository root \uc5d0 \ub193\uc774\uace0, monorepo \uc758 \ub2e4\ub978 folder \ub294 \uc5c6\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">4.5 How the Commands Work<\/h3><a id=\"user-content-45-how-the-commands-work\" class=\"anchor\" aria-label=\"Permalink: 4.5 How the Commands Work\" href=\"#45-how-the-commands-work\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">\ub450 script \uc758 \ud575\uc2ec\uc740 <code>git commit-tree<\/code> \uc640 <code>git push<\/code> \ub450 \uc904\uc774\ub2e4. <code>git rev-parse HEAD:&lt;DIR&gt;<\/code> \uc774 monorepo \uc758 \ub9c8\uc9c0\ub9c9 commit \uc5d0\uc11c \uadf8 folder \uc758 tree \ub97c \uaebc\ub0b4\uace0, <code>git commit-tree<\/code> \ub294 tree \ud558\ub098\uc640 parent \ubaa9\ub85d\uc744 \ubc1b\uc544 commit \uc744 \ub9cc\ub4e0\ub2e4 [<a href=\"#ref-1\">1<\/a>]. Parent \ub97c \uc8fc\uc9c0 \uc54a\uc73c\uba74 \uadf8 commit \uc740 orphan commit \uc774 \ub418\uc5b4 history \uac00 \uc5c6\ub2e4. <code>git push<\/code> \uc758 refspec \uc740 source \uc790\ub9ac\uc5d0 \uc784\uc758\uc758 commit \uc2dd\ubcc4\uc790\ub97c \ubc1b\uc73c\ubbc0\ub85c [<a href=\"#ref-2\">2<\/a>], branch \ub97c \ub9cc\ub4e4\uc9c0 \uc54a\uace0 \uadf8 commit \uc744 remote \uc758 <code>main<\/code> \uc73c\ub85c \uc62c\ub9b0\ub2e4. B.2 \ub294 <code>git fetch<\/code> \ub85c \ubc1b\uc740 remote \uc758 \ud604\uc7ac <code>main<\/code> \uc744 <code>-p FETCH_HEAD<\/code> \ub85c parent \uc5d0 \ub450\ubbc0\ub85c, push \uac00 fast-forward \uac00 \ub418\uc5b4 force \uc5c6\uc774 \uc62c\ub77c\uac04\ub2e4.<\/p>\n<p dir=\"auto\"><code>http.postBuffer<\/code> \ub294 \uae30\ubcf8\uac12\uc73c\ub85c \ub454\ub2e4. \uc774 \uc124\uc815\uac12\ubcf4\ub2e4 \ud070 \uc804\uc1a1\uc740 chunked \ub85c \ub098\uac00\uace0 \uc791\uc740 \uc804\uc1a1\uc740 \ud55c \ubc88\uc758 POST \ub85c \ub098\uac00\ubbc0\ub85c, \uac12\uc744 \uc804\uc1a1\ub7c9\ubcf4\ub2e4 \ud06c\uac8c \uc62c\ub9ac\uba74 git \uc774 \uc804\ubd80\ub97c \uba54\ubaa8\ub9ac\uc5d0 \ubaa8\uc544 \ub2e8\uc77c POST \ub85c \ubcf4\ub0b4\uace0 \uadf8 \uc694\uccad\uc740 server \uc758 body \ud55c\ub3c4\uc5d0 \uac78\ub9b0\ub2e4 [<a href=\"#ref-3\">3<\/a>].<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">5. Application<\/h2><a id=\"user-content-5-application\" class=\"anchor\" aria-label=\"Permalink: 5. Application\" href=\"#5-application\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<ul dir=\"auto\">\n<li><strong>\uac00\uc815<\/strong> \u2014 \ub0b4\ubcf4\ub0bc folder \uac00 monorepo \uc548\uc758 plain file \ub85c\ub9cc \ub418\uc5b4 \uc788\ub2e4. Gitlink \uac00 \uc788\uc73c\uba74 \uadf8 \uc790\ub9ac\ub294 pointer \ub85c \uc804\uc1a1\ub418\uc5b4 \ubc1b\ub294 \ucabd\uc5d0 \ub0b4\uc6a9\uc774 \uc624\uc9c0 \uc54a\ub294\ub2e4.<\/li>\n<li><strong>\uc124\uc815\uac12<\/strong> \u2014 Push \ub300\uc0c1\uc740 <code>refs\/heads\/main<\/code> \ud558\ub098\uc774\uace0, orphan snapshot \uc740 <code>--force<\/code> \ub97c \uc4f0\uba70, <code>http.postBuffer<\/code> \ub294 \uae30\ubcf8\uac12\uc73c\ub85c \ub454\ub2e4.<\/li>\n<li><strong>\uae68\uc9c0\ub294 \uc870\uac74<\/strong> \u2014 Remote \uc758 <code>main<\/code> \uc744 \uc0ac\ub78c\uc774 \uc9c1\uc811 commit \ud558\uba74 \uadf8 commit \uc740 \ub2e4\uc74c \uc2e4\ud589\uc758 force push \uc5d0\uc11c \uc0ac\ub77c\uc9c4\ub2e4. \ubc1b\ub294 \ucabd\uc774 \uc774\uc804\uc5d0 \ubc1b\uc740 commit hash \ub85c \uc7ac\ud604\ud574\uc57c \ud558\ub294 \uacbd\uc6b0\uc5d0\ub3c4 orphan snapshot \uc744 \uc4f8 \uc218 \uc5c6\ub2e4.<\/li>\n<li><strong>\ub9cc\ub098\ub294 \uc790\ub9ac<\/strong> \u2014 Monorepo \uc758 \ud55c folder \ub9cc \ub2e4\ub978 git server \ub85c \ubc30\ud3ec\ud558\ub294 \uc790\ub9ac\uc774\uba70, \ubc1b\ub294 \ucabd\uc740 \uadf8 folder \ub97c \uc77d\uae30\ub9cc \ud55c\ub2e4.<\/li>\n<\/ul>\n<p dir=\"auto\">Remote \ub97c \ubc1b\ub294 \ucabd\uc740 <code>clone<\/code> \ud55c \ub4a4 \ud544\uc694\ud558\uba74 \uadf8 snapshot \uc758 commit hash \ub85c checkout \ud55c\ub2e4. Orphan snapshot \uc73c\ub85c \uc62c\ub9b0 remote \uc5d0\uc11c \uadf8 hash \ub294 \ub2e4\uc74c \uc2e4\ud589\uae4c\uc9c0\ub9cc \uc720\ud6a8\ud558\ubbc0\ub85c, \ubc1b\uc740 \ud310\uc744 \uc624\ub798 \uac00\ub9ac\ucf1c\uc57c \ud558\uba74 chained snapshot \uc73c\ub85c \uc62c\ub9ac\uac70\ub098 remote \uc5d0\uc11c \uadf8 commit \uc5d0 tag \ub97c \ubd99\uc778\ub2e4.<\/p>\n<p dir=\"auto\">\uc2e4\ud589\uc774 \uc2e4\ud328\ud558\uba74 Table 3 \uc5d0\uc11c \uc99d\uc0c1\uc73c\ub85c \uc6d0\uc778\uacfc \ub300\ucc98\ub97c \ucc3e\ub294\ub2e4.<\/p>\n<p dir=\"auto\">Table 3. Failures and fixes<\/p>\n<markdown-accessiblity-table><table>\n<thead>\n<tr>\n<th align=\"center\">Symptom<\/th>\n<th align=\"center\">Cause<\/th>\n<th align=\"center\">Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"center\">Push \uac00 \uc778\uc99d \uc624\ub958\ub85c \ub05d\ub0a8<\/td>\n<td align=\"center\">Token \uc774 \uc5c6\uac70\ub098 \ub9cc\ub8cc\ub418\uc5c8\uac70\ub098 \uc4f0\uae30 \uad8c\ud55c\uc774 \uc5c6\uc74c<\/td>\n<td align=\"center\">\uc4f0\uae30 \uad8c\ud55c\uc774 \uc788\ub294 token \uc744 \ub2e4\uc2dc \ubc1c\uae09\ud574 password \uc5d0 \ub123\uc74c<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">B.1 \uc758 force push \uac00 \uac70\ubd80\ub428<\/td>\n<td align=\"center\">Remote \uc758 <code>main<\/code> \uc5d0 branch protection<\/td>\n<td align=\"center\">B.2 \ub85c \ubc14\uafb8\uac70\ub098 \uadf8 branch \uc5d0 force push \ub97c \ud5c8\uc6a9<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">B.2 \uc758 push \uac00 non-fast-forward \ub85c \uac70\ubd80\ub428<\/td>\n<td align=\"center\">Fetch \uac00 \uc2e4\ud328\ud588\uac70\ub098 fetch \ub4a4 remote \uc758 <code>main<\/code> \uc774 \ubc14\ub01c<\/td>\n<td align=\"center\">Script \ub97c \ub2e4\uc2dc \uc2e4\ud589<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Push \uac00 HTTP 413 \uc73c\ub85c \ub05d\ub0a8<\/td>\n<td align=\"center\"><code>http.postBuffer<\/code> \ub97c \uc804\uc1a1\ub7c9\ubcf4\ub2e4 \ud06c\uac8c \uc62c\ub9bc<\/td>\n<td align=\"center\"><code>http.postBuffer<\/code> \ub97c \uae30\ubcf8\uac12\uc73c\ub85c \ub460<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/markdown-accessiblity-table>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">6. Further Work<\/h2><a id=\"user-content-6-further-work\" class=\"anchor\" aria-label=\"Permalink: 6. Further Work\" href=\"#6-further-work\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">N\/A \u2014 \uc774 \ubb38\uc11c\uc758 \ub450 \ubc29\uc2dd\uacfc \uc808\ucc28\uc5d0 \ub0a8\uc740 \ubbf8\ud655\uc815 \ubc29\ud5a5\uc774 \uc5c6\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">References<\/h2><a id=\"user-content-references\" class=\"anchor\" aria-label=\"Permalink: References\" href=\"#references\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\"><a id=\"user-content-ref-1\"><\/a>\n[1] Git. <a href=\"https:\/\/git-scm.com\/docs\/git-commit-tree\" rel=\"nofollow\">git-commit-tree<\/a>. Git Documentation.<br>\n<a id=\"user-content-ref-2\"><\/a>\n[2] Git. <a href=\"https:\/\/git-scm.com\/docs\/git-push\" rel=\"nofollow\">git-push<\/a>. Git Documentation.<br>\n<a id=\"user-content-ref-3\"><\/a>\n[3] Git. <a href=\"https:\/\/git-scm.com\/docs\/git-config\" rel=\"nofollow\">git-config<\/a>. Git Documentation.<\/p>\n<hr>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">Appendix A. Terminology<\/h2><a id=\"user-content-appendix-a-terminology\" class=\"anchor\" aria-label=\"Permalink: Appendix A. Terminology\" href=\"#appendix-a-terminology\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<ul dir=\"auto\">\n<li><strong>Access token<\/strong>: Password \ub300\uc2e0 git server \uc5d0 \uc778\uc99d\ud558\ub294 \ubb38\uc790\uc5f4\uc774\uba70, \ubc1c\uae09\ud560 \ub54c \uad8c\ud55c\uacfc \ub9cc\ub8cc\uc77c\uc744 \uc815\ud55c\ub2e4.<\/li>\n<li><strong>Branch protection<\/strong>: Git server \uac00 \ud2b9\uc815 branch \uc5d0 \ub300\ud55c push, force push, \uc0ad\uc81c\ub97c \uc81c\ud55c\ud558\ub294 \uc124\uc815\uc774\ub2e4.<\/li>\n<li><strong>Chained snapshot<\/strong>: Remote \uc758 \ud604\uc7ac commit \uc744 parent \ub85c \ub450\uace0 \ub9cc\ub4e0 snapshot commit \uc774\ub2e4.<\/li>\n<li><strong>Commit hash<\/strong>: Commit \ud558\ub098\ub97c \uac00\ub9ac\ud0a4\ub294 40\uc790 \uc2dd\ubcc4\uc790\ub2e4.<\/li>\n<li><strong>Credential helper<\/strong>: Git \uc774 \uc778\uc99d \uc815\ubcf4\ub97c \uc800\uc7a5\ud588\ub2e4\uac00 \ub2e4\uc74c push \uc5d0 \ub2e4\uc2dc \uc4f0\uac8c \ud558\ub294 \uae30\ub2a5\uc774\ub2e4.<\/li>\n<li><strong>Fast-forward<\/strong>: Remote \uc758 ref \ub97c \uadf8 ref \uc5d0\uc11c \uc774\uc5b4\uc9c0\ub294 commit \uc73c\ub85c \uc62e\uae30\ub294 \uac31\uc2e0\uc774\uba70, \uc774\uc5b4\uc9c0\uc9c0 \uc54a\uc73c\uba74 non-fast-forward \ub85c \uac70\ubd80\ub41c\ub2e4.<\/li>\n<li><strong>FETCH_HEAD<\/strong>: <code>git fetch<\/code> \uac00 \ub9c8\uc9c0\ub9c9\uc73c\ub85c \ubc1b\uc544 \uc628 commit \uc744 \uac00\ub9ac\ud0a4\ub294 ref \ub2e4.<\/li>\n<li><strong>Force push<\/strong>: Remote \uc758 ref \ub97c \uae30\uc874 commit \uacfc \uc774\uc5b4\uc9c0\uc9c0 \uc54a\ub294 commit \uc73c\ub85c \ubc14\uafd4 \uc4f0\ub294 push \ub2e4.<\/li>\n<li><strong>Git Bash<\/strong>: Git for Windows \uc640 \ud568\uaed8 \uc124\uce58\ub418\ub294 bash shell \uc774\uba70, Windows \uc5d0\uc11c bash script \ub97c \uc2e4\ud589\ud55c\ub2e4.<\/li>\n<li><strong>Gitlink<\/strong>: \ubd80\ubaa8 repository \uac00 \ub2e4\ub978 repository \uc758 commit \uc744 \uac00\ub9ac\ud0a4\uae30 \uc704\ud574 \uc800\uc7a5\ud558\ub294 pointer \ub2e4.<\/li>\n<li><strong>Monorepo<\/strong>: \uc5ec\ub7ec \uc791\uc5c5\uacfc code \ub97c \ud558\ub098\uc758 repository \uc5d0 \ubaa8\uc544 \ub450\ub294 \uad6c\uc870\ub2e4.<\/li>\n<li><strong>Orphan commit<\/strong>: Parent \uac00 \uc5c6\ub294 commit \uc774\uba70 \uadf8 commit \uc5d0\uc11c \ub2ff\ub294 history \uac00 \uc5c6\ub2e4.<\/li>\n<li><strong>Orphan snapshot<\/strong>: Folder \uc758 tree \ub97c \uac00\ub9ac\ud0a4\ub294 orphan commit \uc73c\ub85c \ub0b4\ubcf4\ub0b4\ub294 \ubc29\uc2dd\uc774\ub2e4.<\/li>\n<li><strong>Refspec<\/strong>: <code>&lt;src&gt;:&lt;dst&gt;<\/code> \uaf34\ub85c \uc801\uc5b4 push \uc640 fetch \uc758 source \uc640 \ubaa9\uc801\uc9c0\ub97c \uc9c0\uc815\ud558\ub294 \uc778\uc790\ub2e4.<\/li>\n<li><strong>Subtree<\/strong>: \ub2e4\ub978 repository \uc758 \ub0b4\uc6a9\uc744 \ubd80\ubaa8 repository \uc758 history \ub85c \ud761\uc218\ud574 \ud558\uc704 folder \uc5d0 \ub450\ub294 \ubc29\uc2dd\uc774\ub2e4.<\/li>\n<li><strong>Tree<\/strong>: Folder \ud558\ub098\uc758 \ub0b4\uc6a9\uc744 \ub2f4\uc740 git object \uc774\uba70, file \uc774\ub984\uacfc \uadf8 \ub0b4\uc6a9\uc758 object \uc774\ub984\uc744 \uac00\uc9c4\ub2e4.<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">Appendix B. Reference Implementation<\/h2><a id=\"user-content-appendix-b-reference-implementation\" class=\"anchor\" aria-label=\"Permalink: Appendix B. Reference Implementation\" href=\"#appendix-b-reference-implementation\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">Section 4 \uc758 \ub450 \ubc29\uc2dd\uc744 \uac01\uac01 \ud55c \ubc88\uc758 \uc2e4\ud589\uc73c\ub85c \uc62c\ub9ac\ub294 script \uc774\uba70, \uac12\uc744 \ubc14\uafb8\ub294 \uc790\ub9ac\ub294 \ub450 script \ubaa8\ub450 \uba38\ub9ac\uc758 \uc138 \ubcc0\uc218\ubfd0\uc774\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">B.1 Orphan Snapshot<\/h3><a id=\"user-content-b1-orphan-snapshot\" class=\"anchor\" aria-label=\"Permalink: B.1 Orphan Snapshot\" href=\"#b1-orphan-snapshot\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">Remote \uc758 <code>main<\/code> \uc744 \uc2e4\ud589\ub9c8\ub2e4 parent \uc5c6\ub294 snapshot commit \ud558\ub098\ub85c \ubc14\uafd4 \uc4f4\ub2e4.<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#!\/usr\/bin\/env bash\nset -euo pipefail\n\nREMOTE_URL='http:\/\/alice@192.0.2.10:3000\/alice\/Widget.git'\nDIR='Falcon'\nMESSAGE='snapshot'\n\ncd &quot;$(git rev-parse --show-toplevel)&quot;\n\ngit add &quot;$DIR&quot;\ngit diff --cached --quiet || git commit -m &quot;$MESSAGE&quot;\n\nTREE=$(git rev-parse &quot;HEAD:$DIR&quot;)\nSNAP=$(git commit-tree &quot;$TREE&quot; -m &quot;$MESSAGE&quot;)\ngit -c http.postBuffer=1048576 push --force &quot;$REMOTE_URL&quot; &quot;$SNAP:refs\/heads\/main&quot;\n\necho &quot;pushed $DIR to $REMOTE_URL as commit $SNAP on main&quot;\"><pre><span class=\"pl-c\"><span class=\"pl-c\">#!<\/span>\/usr\/bin\/env bash<\/span>\n<span class=\"pl-c1\">set<\/span> -euo pipefail\n\nREMOTE_URL=<span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>http:\/\/alice@192.0.2.10:3000\/alice\/Widget.git<span class=\"pl-pds\">'<\/span><\/span>\nDIR=<span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>Falcon<span class=\"pl-pds\">'<\/span><\/span>\nMESSAGE=<span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>snapshot<span class=\"pl-pds\">'<\/span><\/span>\n\n<span class=\"pl-c1\">cd<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-s\"><span class=\"pl-pds\">$(<\/span>git rev-parse --show-toplevel<span class=\"pl-pds\">)<\/span><\/span><span class=\"pl-pds\">\"<\/span><\/span>\n\ngit add <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$DIR<\/span><span class=\"pl-pds\">\"<\/span><\/span>\ngit diff --cached --quiet <span class=\"pl-k\">||<\/span> git commit -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$MESSAGE<\/span><span class=\"pl-pds\">\"<\/span><\/span>\n\nTREE=<span class=\"pl-s\"><span class=\"pl-pds\">$(<\/span>git rev-parse <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>HEAD:<span class=\"pl-smi\">$DIR<\/span><span class=\"pl-pds\">\"<\/span><\/span><span class=\"pl-pds\">)<\/span><\/span>\nSNAP=<span class=\"pl-s\"><span class=\"pl-pds\">$(<\/span>git commit-tree <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$TREE<\/span><span class=\"pl-pds\">\"<\/span><\/span> -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$MESSAGE<\/span><span class=\"pl-pds\">\"<\/span><\/span><span class=\"pl-pds\">)<\/span><\/span>\ngit -c http.postBuffer=1048576 push --force <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$REMOTE_URL<\/span><span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$SNAP<\/span>:refs\/heads\/main<span class=\"pl-pds\">\"<\/span><\/span>\n\n<span class=\"pl-c1\">echo<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>pushed <span class=\"pl-smi\">$DIR<\/span> to <span class=\"pl-smi\">$REMOTE_URL<\/span> as commit <span class=\"pl-smi\">$SNAP<\/span> on main<span class=\"pl-pds\">\"<\/span><\/span><\/pre><\/div>\n<p dir=\"auto\"><code>REMOTE_URL<\/code> \uc740 \ubc1b\ub294 remote repository \uc758 \uc8fc\uc18c\uc774\uace0, <code>DIR<\/code> \uc740 \ub0b4\ubcf4\ub0bc \ud558\uc704 folder \uc774\uba70, <code>MESSAGE<\/code> \ub294 monorepo \uc758 commit \uacfc snapshot \uc5d0 \ud568\uaed8 \uc4f0\ub294 message \ub2e4. <code>cd \"$(git rev-parse --show-toplevel)\"<\/code> \ub294 script \ub97c \uc5b4\ub290 folder \uc5d0\uc11c \uc2e4\ud589\ud558\ub354\ub77c\ub3c4 monorepo \uc758 root \ub85c \uc62e\uae34\ub2e4. <code>git diff --cached --quiet || git commit<\/code> \uc740 stage \ud55c \ubcc0\uacbd\uc774 \uc5c6\uc744 \ub54c commit \uc744 \uac74\ub108\ub6f0\uc5b4, <code>set -e<\/code> \uc544\ub798\uc5d0\uc11c \uc2e4\ud589\uc774 \uc911\ub2e8\ub418\uc9c0 \uc54a\uac8c \ud55c\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">B.2 Chained Snapshot<\/h3><a id=\"user-content-b2-chained-snapshot\" class=\"anchor\" aria-label=\"Permalink: B.2 Chained Snapshot\" href=\"#b2-chained-snapshot\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">B.1 \uc744 \uace0\uccd0, remote \uc758 \ud604\uc7ac <code>main<\/code> \uc744 parent \ub85c \ub450\uace0 \uc0c8 snapshot \uc744 \uadf8 \uc704\uc5d0 \uc787\ub294\ub2e4. Remote \uc758 <code>main<\/code> \uc5d0\ub294 \uc2e4\ud589\ub9c8\ub2e4 snapshot commit \uc774 \ud558\ub098\uc529 \uc313\uc778\ub2e4.<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#!\/usr\/bin\/env bash\nset -euo pipefail\n\nREMOTE_URL='http:\/\/alice@192.0.2.10:3000\/alice\/Widget.git'\nDIR='Falcon'\nMESSAGE='snapshot'\n\ncd &quot;$(git rev-parse --show-toplevel)&quot;\n\ngit add &quot;$DIR&quot;\ngit diff --cached --quiet || git commit -m &quot;$MESSAGE&quot;\n\n# chain onto the remote main; an empty remote has no main, so the first snapshot has no parent\nPARENT=()\nif git fetch &quot;$REMOTE_URL&quot; main; then PARENT=(-p FETCH_HEAD); fi\n\nTREE=$(git rev-parse &quot;HEAD:$DIR&quot;)\nSNAP=$(git commit-tree &quot;$TREE&quot; &quot;${PARENT[@]}&quot; -m &quot;$MESSAGE&quot;)\ngit -c http.postBuffer=1048576 push &quot;$REMOTE_URL&quot; &quot;$SNAP:refs\/heads\/main&quot;\n\necho &quot;pushed $DIR to $REMOTE_URL as commit $SNAP on main&quot;\"><pre><span class=\"pl-c\"><span class=\"pl-c\">#!<\/span>\/usr\/bin\/env bash<\/span>\n<span class=\"pl-c1\">set<\/span> -euo pipefail\n\nREMOTE_URL=<span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>http:\/\/alice@192.0.2.10:3000\/alice\/Widget.git<span class=\"pl-pds\">'<\/span><\/span>\nDIR=<span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>Falcon<span class=\"pl-pds\">'<\/span><\/span>\nMESSAGE=<span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>snapshot<span class=\"pl-pds\">'<\/span><\/span>\n\n<span class=\"pl-c1\">cd<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-s\"><span class=\"pl-pds\">$(<\/span>git rev-parse --show-toplevel<span class=\"pl-pds\">)<\/span><\/span><span class=\"pl-pds\">\"<\/span><\/span>\n\ngit add <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$DIR<\/span><span class=\"pl-pds\">\"<\/span><\/span>\ngit diff --cached --quiet <span class=\"pl-k\">||<\/span> git commit -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$MESSAGE<\/span><span class=\"pl-pds\">\"<\/span><\/span>\n\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> chain onto the remote main; an empty remote has no main, so the first snapshot has no parent<\/span>\nPARENT=()\n<span class=\"pl-k\">if<\/span> git fetch <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$REMOTE_URL<\/span><span class=\"pl-pds\">\"<\/span><\/span> main<span class=\"pl-k\">;<\/span> <span class=\"pl-k\">then<\/span> PARENT=(-p FETCH_HEAD)<span class=\"pl-k\">;<\/span> <span class=\"pl-k\">fi<\/span>\n\nTREE=<span class=\"pl-s\"><span class=\"pl-pds\">$(<\/span>git rev-parse <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>HEAD:<span class=\"pl-smi\">$DIR<\/span><span class=\"pl-pds\">\"<\/span><\/span><span class=\"pl-pds\">)<\/span><\/span>\nSNAP=<span class=\"pl-s\"><span class=\"pl-pds\">$(<\/span>git commit-tree <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$TREE<\/span><span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">${PARENT&#91;@&#93;}<\/span><span class=\"pl-pds\">\"<\/span><\/span> -m <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$MESSAGE<\/span><span class=\"pl-pds\">\"<\/span><\/span><span class=\"pl-pds\">)<\/span><\/span>\ngit -c http.postBuffer=1048576 push <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$REMOTE_URL<\/span><span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">$SNAP<\/span>:refs\/heads\/main<span class=\"pl-pds\">\"<\/span><\/span>\n\n<span class=\"pl-c1\">echo<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>pushed <span class=\"pl-smi\">$DIR<\/span> to <span class=\"pl-smi\">$REMOTE_URL<\/span> as commit <span class=\"pl-smi\">$SNAP<\/span> on main<span class=\"pl-pds\">\"<\/span><\/span><\/pre><\/div>\n<p dir=\"auto\">B.1 \uc5d0\uc11c \ubc14\ub010 \uacf3\uc740 \uc138 \uad70\ub370\ub2e4 (<code>git diff<\/code> \uae30\uc900).<\/p>\n<ol dir=\"auto\">\n<li>\ucd94\uac00 \u2014 <code>PARENT=()<\/code> \uc640 <code>if git fetch \"$REMOTE_URL\" main; then PARENT=(-p FETCH_HEAD); fi<\/code>: remote \uc758 \ud604\uc7ac commit \uc744 <code>FETCH_HEAD<\/code> \ub85c \ubc1b\uc544 \ub450\uace0, \ubc1b\uc9c0 \ubabb\ud558\uba74 <code>PARENT<\/code> \ub97c \ube44\uc6b4\ub2e4. Remote \uac00 \ube44\uc5b4 \uc788\ub294 \uccab \uc2e4\ud589\uc5d0\uc11c\ub294 \uc774 \uacbd\ub85c\ub85c parent \uc5c6\ub294 snapshot \uc774 \ub9cc\ub4e4\uc5b4\uc9c4\ub2e4.<\/li>\n<li>\ubcc0\uacbd \u2014 <code>git commit-tree \"$TREE\" -m \u2026<\/code> \u2192 <code>git commit-tree \"$TREE\" \"${PARENT&#91;@&#93;}\" -m \u2026<\/code>: snapshot \uc774 remote \uc758 \uadf8 commit \uc744 \ubd80\ubaa8\ub85c \uac16\ub294\ub2e4 [<a href=\"#ref-1\">1<\/a>].<\/li>\n<li>\ubcc0\uacbd \u2014 <code>push --force \"$REMOTE_URL\" \u2026<\/code> \u2192 <code>push \"$REMOTE_URL\" \u2026<\/code>: force \ub97c \ube90\uc73c\ubbc0\ub85c fast-forward \uac00 \uc544\ub2c8\uba74 push \uac00 \uac70\ubd80\ub41c\ub2e4.<\/li>\n<\/ol>\n<p dir=\"auto\">Table 4. Orphan and chained snapshot scripts compared<\/p>\n<markdown-accessiblity-table><table>\n<thead>\n<tr>\n<th align=\"center\">Item<\/th>\n<th align=\"center\">B.1 Orphan snapshot<\/th>\n<th align=\"center\">B.2 Chained snapshot<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"center\">Snapshot \uc758 parent<\/td>\n<td align=\"center\">\uc5c6\uc74c<\/td>\n<td align=\"center\">Remote \uc758 \ud604\uc7ac <code>main<\/code> (<code>FETCH_HEAD<\/code>)<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Commit \uc804 \ub2e8\uacc4<\/td>\n<td align=\"center\">\uc5c6\uc74c<\/td>\n<td align=\"center\"><code>git fetch \"$REMOTE_URL\" main<\/code><\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Push<\/td>\n<td align=\"center\"><code>--force<\/code><\/td>\n<td align=\"center\">Force \uc5c6\uc74c (fast-forward)<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Remote \uc758 <code>main<\/code> history<\/td>\n<td align=\"center\">\uc2e4\ud589\ub9c8\ub2e4 commit \ud558\ub098\ub85c \ubc14\ub01c<\/td>\n<td align=\"center\">\uc2e4\ud589\ub9c8\ub2e4 commit \uc774 \ud558\ub098\uc529 \uc313\uc784<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">\uc774\uc804 commit hash<\/td>\n<td align=\"center\">\ub2e4\uc74c \uc2e4\ud589 \ub4a4 \ub2ff\uc744 \uc218 \uc5c6\uc74c<\/td>\n<td align=\"center\">\uacc4\uc18d \ub2ff\uc744 \uc218 \uc788\uc74c<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Remote \uc5d0 \uc9c1\uc811 \ud55c commit<\/td>\n<td align=\"center\">\ub2e4\uc74c \uc2e4\ud589\uc5d0\uc11c \uc0ac\ub77c\uc9d0<\/td>\n<td align=\"center\">Parent \ub85c \ub0a8\uc9c0\ub9cc \uadf8 file \uc740 \ub2e4\uc74c \ud310\uc5d0 \uc5c6\uc74c<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Fetch \uc2e4\ud328 \ub4a4 push<\/td>\n<td align=\"center\">\ud574\ub2f9 \uc5c6\uc74c<\/td>\n<td align=\"center\">Parent \uc5c6\ub294 commit \uc774 \ub418\uc5b4 \uac70\ubd80\ub428<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/markdown-accessiblity-table>\n<p dir=\"auto\">\ub450 script \ubaa8\ub450 tree \ub294 monorepo \uc758 <code>HEAD:$DIR<\/code> \uc5d0\uc11c \uac00\uc838\uc624\ubbc0\ub85c, \uac01 snapshot \uc758 \ub0b4\uc6a9\uc740 \uac19\uace0 \ucc28\uc774\ub294 parent \uc640 push \ubc29\uc2dd\ubfd0\uc774\ub2e4. Table 4 \uc758 \ub9c8\uc9c0\ub9c9 \ud589\uc740 \uc548\uc804\uc7a5\uce58\uc774\ub2e4. \ube44\uc5b4 \uc788\uc9c0 \uc54a\uc740 remote \uc5d0\uc11c fetch \uac00 \uc2e4\ud328\ud558\uba74 parent \uc5c6\ub294 commit \uc740 remote \uc758 <code>main<\/code> \uc5d0\uc11c \uc774\uc5b4\uc9c0\uc9c0 \uc54a\uc544, force \uc5c6\ub294 push \uac00 non-fast-forward \ub85c \uac70\ubd80\ub418\uace0 remote \ub294 \ubc14\ub00c\uc9c0 \uc54a\ub294\ub2e4. \ubcc0\uacbd\uc774 \uc5c6\ub294 \uc2e4\ud589\ub3c4 B.2 \uc5d0\uc11c\ub294 \ub0b4\uc6a9\uc774 \uac19\uc740 snapshot commit \uc744 \ud558\ub098 \ub354 \uc313\ub294\ub2e4.<\/p>\n<\/article><\/div><\/div><\/p>\n<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div>","protected":false},"excerpt":{"rendered":"<p>Git pushes whole branches, so exporting a single monorepo folder normally drags its entire history across the wire. Building a parent-less commit from that folder&#8217;s tree and force-pushing it sends only the current files, giving the receiving clone the folder at its repository root. The cost is unreachable prior hashes and no way back.<\/p>\n","protected":false},"author":4,"featured_media":7209,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","fifu_image_url":"","fifu_image_alt":"","iawp_total_views":2,"footnotes":""},"categories":[378,10],"tags":[386,453],"class_list":["post-7208","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-github","category-software-slug","tag-github-hosted","tag-orphan-commit"],"yasr_visitor_votes":{"stars_attributes":{"read_only":false,"span_bottom":false},"number_of_votes":0,"sum_votes":0},"jetpack_featured_media_url":"https:\/\/ykim.synology.me\/wordpress\/wp-content\/uploads\/2026\/10\/yellow-lemons-produce-bin.jpg","_links":{"self":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts\/7208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/comments?post=7208"}],"version-history":[{"count":1,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts\/7208\/revisions"}],"predecessor-version":[{"id":7210,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts\/7208\/revisions\/7210"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/media\/7209"}],"wp:attachment":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/media?parent=7208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/categories?post=7208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/tags?post=7208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}