This script will sync your origin with upstream master, whether you're currently on master or checked-out on a working branch.
If you don't have an upstream remote then it will just pull and push to origin accordingly.
Just throw this in a file somewhere, chmod 755 that bad boy, and then export PATH="path/to/script:$PATH" in your favorite ~/.rc file to run from anywhere.