Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch naming validation #64

Open
vv12131415 opened this issue Jun 24, 2020 · 6 comments
Open

Branch naming validation #64

vv12131415 opened this issue Jun 24, 2020 · 6 comments

Comments

@vv12131415
Copy link

I'm in love at first sight with this repo ❤️

My idea is to validate branch name against some pattern

so for example,
as I personally mostly use git flow.

Plus I want to see ticket number as a part of the branch
so I write this regex

^(feature|hotfix|bugfix|release)\/(ABC\-)\d{1,}\-[a-zA-Z]+

which will match this one

feature/ABC-3-asddas
@greg0ire
Copy link
Owner

Oh wow thanks that's humbling, really!

Regarding the branch naming validation, when should it be performed? On creation, before push, something else? Maybe it should be configurable?

@vv12131415
Copy link
Author

I think, before push is the right one. Because if it's incorrect, you can easily change the name with

git checkout -b new-branch-name

@Edo78
Copy link
Contributor

Edo78 commented Jun 25, 2020

I think it would be better to check on creation

@greg0ire
Copy link
Owner

git checkout -b new-branch-name

Or git branch -m

Anyway, both things can be done, and we can let the user choose on what event they want the check to happen, maybe?

@vv12131415
Copy link
Author

@greg0ire yes.

I just don't want to over engeneer

@greg0ire
Copy link
Owner

Here is how it's done for make in case you are wondering:

get_hook_config make on hooks optional "pre-push"
if echo "$hooks"|grep --quiet pre-push > /dev/null

get_hook_config make on hooks optional "pre-push"
if echo "$hooks"|grep --quiet pre-commit > /dev/null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants