Redirect blob/tree urls when a branch is renamed #23213
-
If we want to rename our default branch from This is sometimes not possible if the published document is locked. I realize that we just “shouldn’t have linked to a branch because the file gets removed” but for evergreen files such as “README” or “CONTRIBUTING” this would be a bit unfortunate. If GitHub would redirect links to tree and blob (e.g. https://github.com/eps1lon/dom-accessibility-api/blob/f4293f4d373944b583797a960fda958873bb28b9/README.md) for renamed branches we wouldn’t have this issue. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
Hey eps1lon! 👋 Thanks for this feedback! We’re always working to improve GitHub and the GitHub Support Community, and we consider every suggestion we receive. Would you mind submitting this through our official product feedback form so that our product team can track your request? |
Beta Was this translation helpful? Give feedback.
-
What should I fill in under “What part of GitHub is your feedback about?”? |
Beta Was this translation helpful? Give feedback.
-
I think this would come under “other”! That means it goes to the main Product Team, rather than one of the more specialized sub=teams… |
Beta Was this translation helpful? Give feedback.
-
A git repository doesn’t know how branches have been renamed, so I don’t know how this would work. I did suggest a few weeks ago that there should be a synthetic branch name such as Perhaps the suggestion should be that if a URL references a branch that does not exist, it should be redirected to the current default branch with an advisory. |
Beta Was this translation helpful? Give feedback.
-
Sure, github can know it though if it allows branch renaming within its UI. A magic name for default branches wouldn’t help in our case since we go through cycles where main development happens on main or alpha branches. Having docs link to alpha branches would not be ideal. |
Beta Was this translation helpful? Give feedback.
-
One of my work colleagues discovered that you can use HEAD to reference through the project’s default branch. github.comeps1lon/dom-accessibility-api/blob/HEAD/README.md
This file has been truncated. show original |
Beta Was this translation helpful? Give feedback.
-
Thanks! That works for some use cases. If HEAD always points to a “stable” branch or at least candidates for stable then all is fine. But sometimes we go through cycles where development happens on an unstable branch I wouldn’t want links to point to unstable work. Adding redirects for branch renames comes down to “don’t break the web” |
Beta Was this translation helpful? Give feedback.
-
GitHub now redirects broken view links to the default branch. |
Beta Was this translation helpful? Give feedback.
GitHub now redirects broken view links to the default branch.