Last active
May 5, 2024 16:37
-
-
Save james-pre/4b66beda27ec3dc117e685360a5eeade to your computer and use it in GitHub Desktop.
Useful `git` aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Adds some useful git aliases | |
echo "Adding aliases" | |
# Lists changes (i.e. commit messages) | |
# "- " prefixed before each line after any whitespace for easily making a markdown list | |
# You can optionally provide from and to tags. | |
# `git ls-changes` will list changes from the last tag to HEAD | |
# `git ls-changes tag_a` will list changes from tag_a to HEAD | |
# `git ls-changes tag_a tag_b` will list changes from tag_a to tag_b | |
git config --global alias.ls-changes '!f() { from=${1:-$(git describe --tags --abbrev=0)}; to=${2:-HEAD}; git log --format=%B "$from".."$to" | grep -v -e "^$" | sed "s/^\(\s*\)/\1- /"; }; f' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment