Here are the relevant lines from my email generator script. The script greps to see if netdev is in the CC list but wireless isn't. Then it looks up the FIXES_HASH. You have to have to have done a recent fetch obviously. My process doesn't work very well for patchsets. regards, dan carpenter if grep -q netdev $MAIL_FILE && ! grep -q wireless $MAIL_FILE ; then if [ "$FIXES_COMMIT" != "" ] ; then if git merge-base --is-ancestor $FIXES_COMMIT net/main ; then TREE=" net" elif git merge-base --is-ancestor $FIXES_COMMIT net-next/main ; then TREE=" net-next" fi else TREE=" net-next" fi fi if [ "$TREE" == "" ] ; then if [ "$FIXES_COMMIT" != "" ] ; then if ! git merge-base --is-ancestor $FIXES_COMMIT origin/master ; then TREE=" next" fi fi fi git format-patch HEAD^ --stdout | sed -e "s/Subject: \[PATCH\]/Subject: [PATCH${TREE}]/" >> $MAIL_FILE