Created by Igor Brkic 2020-02-12 View revision File gpull Added Side-by-side diff More Ignore whitespace Hide word diff +#!/bin/bash + +# +# list the commits and pull the changes +# + +echo Fetching... +git fetch + +if [ "$?" -ne "0" ]; then + exit $? +fi + +branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') + +output="$(git log --pretty=format:"%ad %s" --date=short --reverse ${branch}..origin/${branch})" + +if [ -z "$output" ]; then + echo No new commits. + exit 0 +fi + +echo "" +echo New commits: +echo -e "$output" + +echo -e "" + +echo Pulling... +git pull