Sure, here is the nicely formatted version in Markdown:
git config --global alias.changelog '!f() { git log master..HEAD --pretty=format:"%s (%h)" --no-merges --first-parent --grep="^feat\\|^fix\\|^docs\\|^style\\|^refactor\\|^perf\\|^test\\|^chore"; }; f'
This alias ensures that:
- Only commits that are on the current branch and not on master are included.
- Commit messages are formatted using conventional commit messages.
- Commit hashes are appended at the end of each message.
- Merges are excluded for cleaner logs.
- Only commits from the first parent (main branch line) are included.
You can now use the alias with the command:
git changelog