Skip to content

Instantly share code, notes, and snippets.

@zax4r0
Last active July 5, 2024 07:19
Show Gist options
  • Save zax4r0/f17ee0249f87a9fcd83dd5b75008c2d1 to your computer and use it in GitHub Desktop.
Save zax4r0/f17ee0249f87a9fcd83dd5b75008c2d1 to your computer and use it in GitHub Desktop.
git

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment