Automatically sanitize new branch names

Answered

This is a feature that I've seen in other IDEs, when creating a new branch and you just want to paste the text, as for example directly from a JIRA issue name, it is required to manually remove all the invalid characters.

 

 

In VSCode for example, the branch names are automatically sanitized.

This is a piece of code which I have personally contributed to a little on vscode, it happens exactly on this line: https://github.com/microsoft/vscode/blob/master/extensions/git/src/commands.ts#L1718

Wouldn't be hard to add the same feature to all JetBrains' IDEs, not sure how the UI would handle this, maybe silently renaming the branch name and removing the warning, maybe add a checkbox that remembers the last decision and shows a preview of the new name under it:

0
2 comments

For all of us suffering from this problem, I created a page where you can sanitize any text into a git-compatible branch name.

It is still raw but pretty much functional, Here's the link: https://protolane.github.io/git-branch-name-normalizer/

0

Please sign in to leave a comment.