#!/bin/sh # git pumm BRANCH - show conflicts of dry-run merge of BRANCH into HEAD set -e fail() { echo ${0##*/}: 1>&2 "$*"; exit 1; } ref=$(git rev-parse --symbolic-full-name $1@{u} 2>/dev/null) || ref=$(git rev-parse --symbolic-full-name $1) case "$ref" in refs/remotes/*/*) branch=${ref#refs/remotes/} repo=${branch%%/*} branch=${branch#*/} git fetch -q $repo $branch git merge-tree $(git merge-base HEAD $repo/$branch) HEAD $repo/$branch ;; refs/heads/*) branch=${ref#refs/heads/} git merge-tree $(git merge-base HEAD $branch) HEAD $branch ;; *) fail "couldn't detect upstream repo" esac | git -p column