[GH-ISSUE #5482] Why use git commit sha on "Edit on GitHub" button? #18896

Closed
opened 2026-04-15 17:35:18 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @max-programming on GitHub (Oct 22, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5482

I just noticed the commit 032159210e by @himself65 that makes use of VERCEL_GIT_COMMIT_SHA env variable for the URL to visit when the "Edit on GitHub" button is clicked on any docs page

So clicking "Edit on GitHub" button will take the user to a page like https://github.com/better-auth/better-auth/blob/d113f99410c8d16348275df8e5fcd71680b062af/docs/content/docs/integrations/tanstack.mdx instead of https://github.com/better-auth/better-auth/blob/main/docs/content/docs/integrations/tanstack.mdx

But GitHub doesn't allow editing on that particular commit SHA page

Image

I believe this adds an extra step for a contributor to then change the branch to main to edit the file.
Can I know the reason behind this change?
I think it should be changed back to main instead of the commit SHA

Originally created by @max-programming on GitHub (Oct 22, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5482 I just noticed the commit 032159210e16c12c1b1d665e41a80efc50f81dea by @himself65 that makes use of `VERCEL_GIT_COMMIT_SHA` env variable for the URL to visit when the "Edit on GitHub" button is clicked on any docs page So clicking "Edit on GitHub" button will take the user to a page like `https://github.com/better-auth/better-auth/blob/d113f99410c8d16348275df8e5fcd71680b062af/docs/content/docs/integrations/tanstack.mdx` instead of `https://github.com/better-auth/better-auth/blob/main/docs/content/docs/integrations/tanstack.mdx` But GitHub doesn't allow editing on that particular commit SHA page <img width="394" height="137" alt="Image" src="https://github.com/user-attachments/assets/7d50738f-3052-4357-af1c-5e275b95ea55" /> I believe this adds an extra step for a contributor to then change the branch to `main` to edit the file. Can I know the reason behind this change? I think it should be changed back to `main` instead of the commit SHA
GiteaMirror added the locked label 2026-04-15 17:35:18 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 22, 2025):

The switch to using the git commit SHA for the "Edit on GitHub" button was made so the link always points to the exact version of the docs as deployed, which helps with consistency and traceability between what's live and what's in the repo. This is especially useful for preview deployments or debugging, since the content matches exactly what users see at that moment. The change was implemented in PR #5000 and falls back to "main" if the SHA isn't available see PR #5000.

However, you're right—GitHub doesn't allow editing files directly when viewing a specific commit, so this adds friction for contributors who want to propose changes. There isn't any discussion in the PRs or code comments about this trade-off or about plans to improve the contributor experience. If contributor workflow is a priority, it might be worth considering switching back to "main" or providing both links.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3432208902 --> @dosubot[bot] commented on GitHub (Oct 22, 2025): <!-- Answer --> The switch to using the git commit SHA for the "Edit on GitHub" button was made so the link always points to the exact version of the docs as deployed, which helps with consistency and traceability between what's live and what's in the repo. This is especially useful for preview deployments or debugging, since the content matches exactly what users see at that moment. The change was implemented in PR #5000 and falls back to "main" if the SHA isn't available [see PR #5000](https://github.com/better-auth/better-auth/pull/5000). However, you're right—GitHub doesn't allow editing files directly when viewing a specific commit, so this adds friction for contributors who want to propose changes. There isn't any discussion in the PRs or code comments about this trade-off or about plans to improve the contributor experience. If contributor workflow is a priority, it might be worth considering switching back to "main" or providing both links. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/21b6b32d-d5aa-4a49-9f2d-3348097fd85d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/21b6b32d-d5aa-4a49-9f2d-3348097fd85d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/21b6b32d-d5aa-4a49-9f2d-3348097fd85d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/21b6b32d-d5aa-4a49-9f2d-3348097fd85d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/21b6b32d-d5aa-4a49-9f2d-3348097fd85d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/21b6b32d-d5aa-4a49-9f2d-3348097fd85d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/21b6b32d-d5aa-4a49-9f2d-3348097fd85d?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/5482)
Author
Owner

@ping-maxwell commented on GitHub (Oct 22, 2025):

I wonder if it relates to preview deployments, not sure though

<!-- gh-comment-id:3432480127 --> @ping-maxwell commented on GitHub (Oct 22, 2025): I wonder if it relates to preview deployments, not sure though
Author
Owner

@max-programming commented on GitHub (Oct 22, 2025):

@dosu I understand the purpose of the SHA link, but the reason I think that link is irrelevant only in this scenario is that the button serves the purpose to literally "Edit on GitHub". So it's natural for a contributor to click on the button and directly click on the Edit button provided by GitHub

<!-- gh-comment-id:3432677419 --> @max-programming commented on GitHub (Oct 22, 2025): @dosu I understand the purpose of the SHA link, but the reason I think that link is irrelevant **only in this scenario** is that the button serves the purpose to literally "Edit on GitHub". So it's natural for a contributor to click on the button and directly click on the Edit button provided by GitHub
Author
Owner

@dosubot[bot] commented on GitHub (Oct 22, 2025):

You're absolutely right—the current use of the commit SHA in the "Edit on GitHub" button makes direct editing impossible, since GitHub only allows edits on branches, not on specific commits. The change to use the SHA was made to ensure the link always matches the exact deployed version of the docs, which is helpful for traceability and debugging, especially in preview deployments. However, there’s no logic in the codebase to support branch selection or dual links, and there’s no documentation or code comments addressing this trade-off or the contributor experience friction it causes cite.

If improving the contributor workflow is a priority, one workaround would be to switch the button back to always use the main branch, or to provide both a "View this version" (SHA) and an "Edit on main" link. Right now, though, the implementation is hardcoded to prefer the SHA if available, with no built-in way to change this behavior cite.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3432697107 --> @dosubot[bot] commented on GitHub (Oct 22, 2025): <!-- Answer --> You're absolutely right—the current use of the commit SHA in the "Edit on GitHub" button makes direct editing impossible, since GitHub only allows edits on branches, not on specific commits. The change to use the SHA was made to ensure the link always matches the exact deployed version of the docs, which is helpful for traceability and debugging, especially in preview deployments. However, there’s no logic in the codebase to support branch selection or dual links, and there’s no documentation or code comments addressing this trade-off or the contributor experience friction it causes [cite](https://github.com/better-auth/better-auth/blob/fa6ee9d68214c6a51e7253b53f957407b116b0c4/docs/app/docs/[[...slug]]/page.tsx). If improving the contributor workflow is a priority, one workaround would be to switch the button back to always use the `main` branch, or to provide both a "View this version" (SHA) and an "Edit on main" link. Right now, though, the implementation is hardcoded to prefer the SHA if available, with no built-in way to change this behavior [cite](https://github.com/better-auth/better-auth/pull/5000). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ca1af605-9787-46a9-b27c-3886e2b382bf?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ca1af605-9787-46a9-b27c-3886e2b382bf?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ca1af605-9787-46a9-b27c-3886e2b382bf?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ca1af605-9787-46a9-b27c-3886e2b382bf?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ca1af605-9787-46a9-b27c-3886e2b382bf?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ca1af605-9787-46a9-b27c-3886e2b382bf?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ca1af605-9787-46a9-b27c-3886e2b382bf?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/5482)
Author
Owner

@himself65 commented on GitHub (Oct 22, 2025):

uhm, good question. I think I copied from somewhere. But we should change it to canary branch

<!-- gh-comment-id:3432909344 --> @himself65 commented on GitHub (Oct 22, 2025): uhm, good question. I think I copied from somewhere. But we should change it to canary branch
Author
Owner

@max-programming commented on GitHub (Oct 22, 2025):

@himself65 I opened a PR with a proper and non-confusing change

<!-- gh-comment-id:3433093733 --> @max-programming commented on GitHub (Oct 22, 2025): @himself65 I opened a PR with a proper and non-confusing change
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#18896