【bash】将本地未合入 master 的分支,生成对应 patche 文件
#!bin/bash
if [ $# -ne 1 ]; then
echo "Please input directory name."
echo "Usage: "
echo "\033[33m $0 <directory> \033[0m"
exit 1
fi
OUTPUT_DIR="$(pwd)/patches"
mkdir -p $OUTPUT_DIR
branches=$(git branch --no-merged master)
for branch in $branches; do
echo "\033[31m \$current branch:\033[0m $branch: "
git format-patch master..$branch -o $OUTPUT_DIR/$branch
done