-
-
Notifications
You must be signed in to change notification settings - Fork 184
-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Question for commit filtering #34
Comments
Hello! Thank you 🐻
It is not currently possible. However, you specify the $ git cliff --commit-path libs/ But now that I think of it, I can probably modify this argument to take a regular expression as a value so you can include/exclude any path. e.g. $ git cliff --commit-path "^(?!apps\/*)(.+)$" How does that sound? If it's applicable, I can work on implementing it.
I don't think it is currently possible to differentiate the merge commits from other commits if the commit message is the same. Otherwise I'd say it can easily be done using commit_parsers. Can you post an example git history with commit messages along with the merge commits to make things a bit clear here? |
Unfortunately we also care for file changes at the root of the repo which can't be relocated under the For the merge commits, I'm not a git guru, but I think we need to check how many parents the commit has. Merge commits have two parents or so https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---merges https://stackoverflow.com/questions/9059335/how-can-i-get-the-parents-of-a-merge-commit-in-git I went through our git history and I see this mentioned in the metadata, if I do
Notice that the first two commits are merge commits and they have a "Merge" field in their metadata. These are two different merge requests that got merged into master branch. The last commit in the example is referenced by the first MR, so one of them should be excluded to avoid duplication. As I'm typing these lines, I'm thinking we should probably be excluding the merge commits, because they have the extra text in the commit message "Merge branch 'blah' into 'master'" which violates conventional commit message style... So maybe it's possible to do this by setting conventional commits to true (which is something we'd like to enforce) and add a commit parser like
? |
Edit: please ignore new question, found an example https://github.com/orhun/git-cliff/blob/main/examples/scoped.toml seconds after I posted the question 🤦 @orhun can I ask you one extra question? I was trying to utilize the conventional commit message scope in the commit parsers but it doesn't seem to be possible i.e.
Since we have a monorepo of multiple libraries, I was hoping people could have commit messages like "feat(my-cool-library): Adding my cool feature" and I'll end up with a dedicated group in the changelog for "my-cool-library". |
Hello again! Sorry for the late reply :/
I implemented the following arguments:
You can use them multiple times or in conjunction. They also support glob patterns: git cliff --include-path "**/*.toml" --include-path "*.md"
git cliff --exclude-path ".github/*" I hope that will be sufficient for your use case 🙂 P.S. I renamed the old
Of course, you can skip the merge commits like that. Other than that, I'm not really sure how to "remove" duplicate commit messages. Skipping seems like a good solution to me. However, let me know if you need anything else regarding this.
Ah, good point. Parser regex'es does not support grouping yet. But instead you can achieve the same thing by using a template like this: {% for group, commits in commits | group_by(attribute="scope") %}
### {{ group | upper_first }}
{% for commit in commits %}
- ({{ commit.group | lower }}) {{ commit.message | upper_first }}\
{% endfor %}
{% endfor %} So if you commit something like
About the regex grouping, feel free to submit a separate issue for tracking and I'm more than happy to work on it 🐻 |
Thank you very much @orhun ! Let's close this issue whenever you like, either now or when you make a new release that has the new features |
|
Hello, we're evaluating using git-cliff for our monorepo, in order to automate the generation of the CHANGELOG. The tool looks really powerful!
We have a couple of questions:
The text was updated successfully, but these errors were encountered: