Branch Name Sanitizer - simple program that savely cleans text inputs focusing on comply with Git repository naming conventions.
- Gently clean all accent characters from input, e.g:
é=>e,ă=>a, etc. - Persist characters meaning conversion, e.g.
ö=>ou,&=>-and-, etc. - Customization of strings connector
- Option to allow only ASCII characters
- Option to keep original case
go install github.com/egel/bns/cmd/bns@latestAdd new gitconfig alias name e.g.: cob (acronym of checkout -b), brn (branch new), or anything else that suite your preferences.
# file ~/.gitconfig
[alias]
cob = !sh -c 'git checkout -b $(bns $@)' -
then you can automatically checkout to a new, clean branch using command like following:
git cob "fancy name of your new branch"bns "Introduce new dashboard UI" # => introduce-new-dashboard-uiflag: -c, --connector
bns -c "_" "Develop AI-powered bug reporter" # => develop_ai_powered_bug_reporterflag: -o, --original-case
bns -o "Task: Implement Login Feature" # => Task-Implement-Login-Featureflag: -f, --force-ascii.
If you need a strict non-ASCII complience.
# Arabic
bns -f "تحسين: amélioration du dashboard de l'utilisateur" # => amlioration-du-dashboard-de-l-utilisateur
# Chinese (mandarin)
bns -f "BUG:搜索功能不工作" # => bugNote
When passing multiple strings as arguments to your tool, make sure to enclose each one in quotes to ensure they are treated as input values rather than flags or options.
# hey! I also works as arg list!
bns This is fancy new feature! # => this-is-fancy-new-featureTo upgrade to the latest version use:
GONOPROXY=github.com/egel go install github.com/egel/bns/cmd/bns@latest-
remove the binary from system
rm $(command -v bns) -
remove the alias from your
~/.gitconfig
Apache-2.0 license