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

How to handle branch merges with this plugin? #130

Closed
mklueh opened this issue Dec 2, 2022 · 5 comments
Closed

How to handle branch merges with this plugin? #130

mklueh opened this issue Dec 2, 2022 · 5 comments
Labels

Comments

@mklueh
Copy link

mklueh commented Dec 2, 2022

When you merge one branch into another, git will create messages like Merged branch 'master' into xyz, which obviously does not match the conventional commit pattern.

What is the general approach using this plugin? Is it possible to exclude those?

@nicolasfara
Copy link
Owner

Hi @mklueh,

The best approach I could suggest is to use rebase instead of merge as a merge method for a branch.
Using the rebase you don't have a merge commit and the history is linear. In this case, the plugin works fine.

Currently, there aren't any methods to "suppress" the check. But I will investigate a way to suppress the check, somehow :)

If you want to use the merge as a merge strategy, you could modify the commit message to make it conventional commit compliant. For example, if the merge commit is the last one in the local history, you could modify it with `git commit --amend" and edit the commit message (chore: Merge branch 'master' into XYZ).

@mklueh
Copy link
Author

mklueh commented Dec 16, 2022

@nicolasfara Thank you!

Not sure if rebasing is an option in our case. Adjusting the commit message could be an idea :)

Would it be possible to exclude merges from the hook in general? For example, current scenario:

One college merged a non-conventional commit into master, because the plugin is currently not on master.

I try to merge master into my branch, and the plugin complains that merging is not possible because of non-conventional commits.

Now in order to get it merged, I had to go to .git/hooks and delete the hook of the plugin.

Would it make sense to ignore those merges and just focus on "normal" local commits?

@kmbisset89
Copy link

I am also running into something like this trying to use the plugin. My CI/CD is failing in my GitLab MR because it cannot get the hook messages.

@nicolasfara
Copy link
Owner

I tried to fix this issue by releasing a new plugin version that makes it possible to configure a regex so that if a commit message matches it, the check succeeds.

Please don't hesitate to reopen this issue if there are problems with this approach.

The settings key added is ignoreCommitMessage and a regex should be specified.

nicolasfara pushed a commit that referenced this issue Dec 31, 2022
# [3.1.0](3.0.14...3.1.0) (2022-12-31)

### Features

* add the ability to exclude commit message that match a configured regex. Closes [#130](#130) ([a822194](a822194))
@nicolasfara
Copy link
Owner

🎉 This issue has been resolved in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

3 participants