[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,65 +2,147 @@
|
||||
id: wiki-2026-0508-source-control
|
||||
title: Source Control
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-SOCO-001]
|
||||
aliases: [version control, VCS, git workflow]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.98
|
||||
tags: [auto-reinforced, source-control, version-control, git, collaboration, rollback, single-source-of-truth]
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [git, version-control, devops, workflow, collaboration]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: shell
|
||||
framework: git-github-jujutsu
|
||||
---
|
||||
|
||||
# [[Source-Control|Source-Control]]
|
||||
# Source Control
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "시간 여행의 기록 장치: 수백 명이 동시에 소스코드를 수정해도 충돌을 지능적으로 해결하고, 실수로 전체 코드를 날려먹어도 '어제 오후 2시' 상태로 완벽히 되돌릴 수 있게 보장하는 협업의 타임머신이자 프로젝트의 블랙박스."
|
||||
## 매 한 줄
|
||||
> **"매 commit 의 atomic unit of intent"**. Source control (VCS) 의 code changes 의 의 history 의 record 의, 매 collaboration / rollback / branching 의 의 enable 의. 2026 의 dominant 의 git, 매 emerging: Jujutsu (jj) 의 ergonomic next-gen, 매 Sapling (Meta).
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
소스 제어(Source-Control) 혹은 버전 관리(Version Control)는 소프트웨어 소스코드의 변경 사항을 추적하고 관리하는 시스템입니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **핵심 기능**:
|
||||
* **Branching/Merging**: 나만의 실험장을 만들어 코딩하고, 검증 후 본진에 합침. ([[Pull-Request|Pull-Request]]와 연결)
|
||||
* **Audit Trail**: 누가 어떤 의도로 이 한 줄을 바꿨는지 영구 기록.
|
||||
* **Conflicts Re[[Solution|Solution]]**: 같은 곳을 동시에 고쳤을 때 합의점 정책 제시.
|
||||
2. **왜 중요한가?**:
|
||||
* 소스 제어 없는 개발은 '눈 가리고 아우토반을 달리는 것'과 같으며, 지식의 유실 정책을 막고 대규모 협업 정책을 가능케 하는 현대 문명의 근간이기 때문임. ([[Repository|Repository]]의 핵심 로직)
|
||||
### 매 git 의 mental model
|
||||
- **Snapshot**, not diffs. 매 commit 의 tree (file content hashes) 의 reference.
|
||||
- **Three trees**: working dir, index (stage), HEAD.
|
||||
- **Refs**: branches, tags, HEAD 의 commit pointers.
|
||||
- **Object store**: blobs, trees, commits, tags — content-addressed (SHA-1/SHA-256).
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거에는 중앙 서버에 의존하는 방식(SVN 등)이었으나, 현대 정책은 모든 팀원이 전체 이력을 가지는 '분산 버전 관리(Git)' 정책이 압도적 표준이 됨(RL Update). (Git와 연결)
|
||||
- **정책 변화(RL Update)**: 코드를 넘어 AI 모델의 가중치(Weights)나 데이터셋의 변화 정책까지 버전 관리하는 'Data/Model Version Control (DVC)'로 그 영역 정책이 확장되고 있음.
|
||||
### 매 modern workflows
|
||||
- **Trunk-based**: short-lived branches (<24h), main 의 always deployable.
|
||||
- **GitHub Flow**: feature branch → PR → merge to main.
|
||||
- **GitFlow** (legacy): heavy 의 develop/release/hotfix branches — 매 2026 의 거의 not 추천.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- Git, [[Pull-Request|Pull-Request]], [[Repository|Repository]], Standard-Operating-Procedure, [[Reliability|Reliability]], Collaboration
|
||||
- **Modern Tech/Tools**: Git, GitHub, GitLab, Bitbucket, DVC (Data Version Control).
|
||||
---
|
||||
### 매 응용
|
||||
1. Trunk-based + feature flags (modern PLG SaaS).
|
||||
2. Stacked PRs (Graphite, Sapling) for big changes.
|
||||
3. Monorepo (Nx, Turborepo, Bazel).
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
## 💻 패턴
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### Conventional commits + commitlint
|
||||
```js
|
||||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
rules: {
|
||||
'type-enum': [2, 'always', ['feat','fix','chore','docs','refactor','test','perf','build','ci']],
|
||||
'scope-empty': [2, 'never'],
|
||||
'subject-max-length': [2, 'always', 72],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### Pre-push hook (husky)
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
pnpm test --run && pnpm lint
|
||||
```
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
### Squash-merge default + linear history
|
||||
```bash
|
||||
gh repo edit OWNER/REPO \
|
||||
--enable-squash-merge --enable-rebase-merge=false --enable-merge-commit=false \
|
||||
--delete-branch-on-merge
|
||||
```
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### Stacked PRs (Graphite)
|
||||
```bash
|
||||
gt branch create feat-foundation
|
||||
gt branch create feat-api
|
||||
gt submit --stack
|
||||
```
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
### Bisect 매 regression
|
||||
```bash
|
||||
git bisect start
|
||||
git bisect bad HEAD
|
||||
git bisect good v2.3.0
|
||||
git bisect run pnpm test:e2e:smoke
|
||||
git bisect reset
|
||||
```
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
### Rerere 의 conflict 의 reuse
|
||||
```bash
|
||||
git config --global rerere.enabled true
|
||||
```
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
### Worktrees 의 parallel branches
|
||||
```bash
|
||||
git worktree add ../proj-hotfix hotfix/v2.3.1
|
||||
git worktree remove ../proj-hotfix
|
||||
```
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
### Sparse-checkout (monorepo)
|
||||
```bash
|
||||
git sparse-checkout init --cone
|
||||
git sparse-checkout set apps/web packages/ui
|
||||
```
|
||||
|
||||
### Signed commits (sigstore gitsign)
|
||||
```bash
|
||||
gitsign init
|
||||
git -c commit.gpgsign=true commit -m "feat: thing"
|
||||
gitsign verify HEAD --certificate-identity=me@org.com \
|
||||
--certificate-oidc-issuer=https://accounts.google.com
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Workflow |
|
||||
|---|---|
|
||||
| SaaS startup, daily deploy | trunk-based + feature flags |
|
||||
| OSS library | GitHub Flow + protected main |
|
||||
| regulated (releases) | release branches + CHANGELOG |
|
||||
| monorepo of apps | trunk-based + Nx affected + sparse |
|
||||
|
||||
**기본값**: trunk-based, squash-merge, conventional commits, signed commits (gitsign), CODEOWNERS-protected main.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[DevOps]] · [[Software Engineering]]
|
||||
- 변형: [[Mercurial]] · [[Jujutsu]] · [[Sapling]] · [[Perforce]]
|
||||
- 응용: [[Trunk-Based Development]] · [[Code Review]] · [[Monorepo]]
|
||||
- Adjacent: [[CODEOWNERS]] · [[Conventional Commits]] · [[GitOps]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: commit message generation, PR description drafts, conflict resolution suggestions, blame summarization.
|
||||
**언제 X**: rebasing 의 LLM-driven 의 unchecked — 매 history 의 corrupt 위험.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Long-lived feature branches** (>1wk): 매 merge hell.
|
||||
- **Force-push to shared branches**: 매 teammates' work 의 destroy.
|
||||
- **Big-bang commits**: 매 review impossible, bisect useless.
|
||||
- **No CODEOWNERS**: 매 누구나 의 critical path 의 merge.
|
||||
- **Secrets in history**: 매 even after rotation, 매 forever exposed.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Pro Git book, GitHub flow docs, Trunk-Based Development site, Conventional Commits 1.0).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — git workflow + stacked PR + sigstore patterns |
|
||||
|
||||
Reference in New Issue
Block a user