Submitted by CrashTest_ on Thu, 12/03/2009 - 13:09
So lately I have been having all kinds of issues forgetting to do a git pull before doing a git push. Decided to make sure that doesn't happen any more.
#!/bin/bash
# This little script just makes it easier to do all of the git things I do all at once,
# so instead of typing git add file1.fl file2.fl etc, then git pull, then
# git commit -m "blah blah blah", this let's me just type:
# gp "My commit message" all.my files.etc
args=("$@")
if [[ ${args[0]} == '--help' || ${args[0]} == '-h' || ${args[0]} == '/?' ]]; then
echo "Usage: gp "Your commit message in quotes" filetocommit.ext file2tocommit.ext etcToCommit.ext"
exit
fi
for (( i=1; i<$#;i++)); do
git add ${args[i]}
done
git commit -m "${args[0]}"
git pull
git push

Thanks!
Thanks Patrick, that will save me some time!