git merge-span

Merge span aliases

Git alias:

# Given a merge commit, find the span of commits that exist(ed).
# Not so useful in itself, but used by other aliases.
# Thanks to Rob Miller for the merge-span-* aliases.
merge-span = !"f() { \
    echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | \
    cut -d' ' -f2); \
}; f"

# Find the commits that were introduced by a merge
merge-span-log = "!git log `grave;git merge-span .. $1`grave;"

# Show the changes that were introduced by a merge
merge-span-diff = !"git diff `grave;git merge-span ... $1`grave;"

# Show the changes that were introduced by a merge, in your difftool
merge-span-difftool = !"git difftool `grave;git merge-span ... $1`grave;"

Example:

git merge-span
git merge-span-log
git merge-span-diff
git merge-span-difftool

Compare: