Skip to content
Discussion options

You must be logged in to vote

Yo @Andre601 — unfortunately, using HEAD doesn't work for /edit/ URLs because HEAD is a symbolic reference to the current commit, not a branch name. The editor needs a real branch target to apply changes to.
Right now, GitHub doesn't support a "default branch wildcard" for edit links. The URL structure strictly requires a branch name (like main or master).
You're right that fetching the default branch via API is the robust way, but for a quick hack without API calls? You can usually safely assume main in 2026. Most repos have migrated, and the edge cases are small enough that it might be worth the risk for your tool.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Andre601
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Repositories The core of version-controlled code storage Question Ask and answer questions about GitHub features and usage inactive This discussion has been automatically marked as inactive. This was formerly labeled stale. source:ui Discussions created via Community GitHub templates
2 participants