-
Notifications
You must be signed in to change notification settings - Fork 4
chore: well-known 파일에 대한 dev main 각기 다른 버전 갖도록 gitattributes 적용 #2202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # dev → main merge 시 대상 브랜치(main)의 .well-known 버전 유지 | ||
| functions/.well-known/** merge=ours | ||
| public/.well-known/** merge=ours | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| "playground-common" | ||
| ], | ||
| "scripts": { | ||
| "prepare": "git config merge.ours.driver true || true", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI/CD 환경 및 드라이버 미등록 시 무음 실패(silent failure) 위험
더 중요한 것은, 드라이버를 등록하지 않으면 위 🤖 Prompt for AI Agents |
||
| "analyze": "cross-env ANALYZE=true next build", | ||
| "build": "next build", | ||
| "build-storybook": "cross-env NODE_OPTIONS='--max-old-space-size=4096' storybook build", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge=ours드라이버는 단방향 변경 시 동작하지 않습니다이 설정은 실제 merge 중에 병합이 필요한 파일에만 적용됩니다. 중요하게도, merge 중에 해당 파일이 merge base 이후 병합 대상 브랜치에서만 수정된 경우 실제 병합이 필요하지 않으므로 수정된 버전이 그대로 적용됩니다.
즉, dev 브랜치에서만
.well-known파일이 수정되고 main 브랜치는 공통 조상 이후 해당 파일을 변경하지 않았다면, Git은 충돌로 인식하지 않고 dev 버전을 그대로 main에 적용합니다. 드라이버는 호출되지 않습니다.🤖 Prompt for AI Agents
🧩 Analysis chain
🌐 Web query:
GitHub PR merge custom merge driver gitattributes💡 Result:
GitHub’s Pull Request “Merge” button does not run your repo’s custom merge drivers (the
merge=<name>entries in.gitattributesthat rely onmerge.<name>.driver), so you can’t make GitHub’s server-side PR merge automatically apply your custom merge tool.merge.<name>.driverin.git/configor~/.gitconfig), not in.gitattributes, and GitHub can’t safely execute arbitrary, repo-supplied programs during merges. Git docs explicitly place the driver definition in config, not attributes. [1].gitattributesin the web conflict editor/merge flow in the way people expect. [3]What you can do instead
git mergein your own environment where the driver is configured, then push the result. [2]merge.<name>.driver, perform the merge, and push back (or open an updated PR). This is the usual way to get deterministic “server-side” merges while still using custom drivers. [2]merge.<name>.driverexecution won’t happen unless you do (1) or (2).Sources:
[1] Git documentation: custom merge driver is defined in Git config, invoked via
.gitattributesmerge=<name>. https://git-scm.com/docs/gitattributes.html[2] Stack Overflow: “GitHub does not support custom merge drivers… use a bot / merge locally.” https://stackoverflow.com/questions/65309426/how-to-enable-custom-merge-driver-gitattributes-in-github
[3] GitHub Community discussion referencing GitHub Support response about not considering user
.gitattributesin PR conflict handling. https://github.com/orgs/community/discussions/9288🌐 Web query:
GitHub server-side merge gitattributes merge=ours driver💡 Result:
GitHub’s server-side merge (the merge that happens when you click “Merge pull request”) does not run custom Git merge drivers, because merge-driver commands are defined in Git config (e.g.,
merge.<name>.driver) and GitHub will not execute arbitrary programs based on repository content for security reasons. So a repo-only.gitattributesline like:won’t be honored on GitHub unless the server is explicitly configured with a matching driver (which GitHub.com does not support for arbitrary repos). (stackoverflow.com)
What does work:
.gitattributes(merge drivers are configured in Git config, not shipped in the repo). (stackoverflow.com)merge.<name>.driverglobally so.gitattributescan take effect during server-side merges. (docs.gitlab.com)Practical workaround on GitHub: perform merges via a bot/GitHub Action (checkout → set
merge.ours.driver→ merge → push), and restrict merges to that automation. (stackoverflow.com)Citations:
🌐 Web query:
GitHub API merge behavior custom merge drivers 2024 2025💡 Result:
PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge),merge_methodcan only bemerge,squash, orrebase. [1]git rebase. [2].gitattributesmerge=…with a[merge "..."] driver = ...command) are not supported on GitHub.com/GitHub-hosted merges, because the driver command lives in Git config (not in the repo) and running arbitrary commands server-side would be a security risk. [3]Sources:
[1] GitHub REST API – “Merge a pull request” (
merge_method: merge/squash/rebase) (docs.github.com)[2] GitHub Docs – merge methods + note on rebase-and-merge behavior and merge queue controlling merge method (docs.github.com)
[3] Stack Overflow (bk2204) – GitHub does not support custom merge drivers; config not shipped; security hazard; use a bot (stackoverflow.com)
[4] GitHub Docs – Managing a merge queue (merge method selection in queue settings) (docs.github.com)
Citations:
GitHub PR 병합은 커스텀 merge driver를 실행하지 않습니다
GitHub는 사용자가 정의한
.gitattributes의merge=ours설정을 PR 병합 시 적용하지 않습니다. 이는 GitHub의 알려진 플랫폼 제한 사항으로, 커스텀 merge driver의 명령어가 Git 설정 파일(.git/config또는~/.gitconfig)에 정의되어 있고, GitHub가 보안상의 이유로 저장소 콘텐츠 기반의 임의 프로그램 실행을 허용하지 않기 때문입니다. 따라서 이 접근 방식으로는 dev → main 병합 시.well-known버전을 보호하는 목표를 달성할 수 없습니다.실제 대안:
.well-known파일을 배포 워크플로우에서 관리: 환경별 버전을 배포 시점에 주입하도록 변경하여, 소스 코드 병합과 배포 관리를 분리합니다.🤖 Prompt for AI Agents