git log with refs of body #!/bin/bash COMMITS=${1} DELIMITER="|" RET_GITLOG=`git log --format=format:"${DELIMITER} %h ${DELIMITER} %s ${DELIMITER}" ${COMMITS}` HEADER="${DELIMITER} Hash ${DELIMITER} Subject ${DELIMITER} Refs ${DELIMITER}" function func_append_refs { while true do read -r MY_LINE if [ "${MY_LINE}" == "" ]; then return fi COMMIT_HASH=`echo "${MY_LINE}" | awk -F "${DELIMITER}" ' { print $2 } '` REFS_LOG=`git log -1 ${COMMIT_HASH} --format=format:'%b' | egrep -i "refs|fix"` echo "${MY_LINE} ${REFS_LOG} |" done } echo "${HEADER}" echo "${RET_GITLOG}" | func_append_refs