1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/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
You can clone a snippet to your computer for local editing. Learn more.