#!/usr/bin/env bash # Pull any changes from the remote Git server. # # This writes a list of files that will be changed to `.git/names_diff.txt`, # which can be used by upstream scripts to customise their behaviour. set -o errexit set -o nounset _ensure_ssh_key_loaded ROOT="$(git rev-parse --show-toplevel)" HEAD="$(git rev-parse --abbrev-ref HEAD)" # This avoids any clashes with other programs called "gp", e.g. at one # point I had gitpython in my PATH $(dirname "$0")/gf echo "" # Log a list of files which will be changed to .git/names_diff.txt git diff --name-status "$HEAD" "origin/$HEAD" > "$ROOT/.git/names_diff.txt" 2>/dev/null if [[ "${1:-}" == "--rebase" ]] then print_info "-> git rebase origin/$HEAD" git rebase "origin/$HEAD" else print_info "-> git merge origin/$HEAD" git merge "origin/$HEAD" fi