#!/bin/bash git_dir='/usr/src/github/openttd' branches=( signaltunnel sloped-stations underground ) cd "$(dirname "$(readlink -f "$0")")" for branch in "${branches[@]}"; do git -C "${git_dir}" diff \ "$( git -C "${git_dir}" merge-base "${branch}" upstream/master )" \ "${branch}" > \ "${branch}.patch" done