# Finding Which Git Commit Merged a File Section a.k.a. finding the merge request of a particular commit. You can use add the following aliases to your config, and then use `git find-merge <commitish> [<commitish>]` The first argument is the commit and the second argument the branch it was merged into. If second argument is left blank it defaults to `HEAD`. ``` find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'" show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'" ``` To find out which commit deleted a file section see [[Finding Which Git Commit Deleted a File Section]]