Simple sh script to automate a git update
#!/bin/sh
if [ $# != 2 ]; then
echo "\nchris k's git update automater sh script. Edit to put a bunch of \`git add blah'"
echo "lines in the body then evoke with the branch name and commit description\n"
echo "Usage: $0 <branch_name> <\"Description of update\">\n"
echo " branch_name: the name of the git branch to be created"
echo " Description: Text for: git commit -m \"Description of update\""
echo ""
echo "Example:"
BRANCH="core_override"
MESSAGE="Edited core files to fix system.log warnings"
echo " $0 $BRANCH \"$MESSAGE\"\n\nWhich then executes the following:\n"
echo "git checkout -b $BRANCH"
echo "git add /app/code/local/Mage/some/buggy/core/file"
echo "commit -m \"$MESSAGE\""
echo "git checkout master"
echo "git merge --no-ff $BRANCH"
echo "git branch -d $BRANCH"
echo "git push origin master"
echo "\n"
exit
fi
BRANCH=$1
MESSAGE=$2
git checkout -b $BRANCH
echo "Adding the changed files you edited to put in this script:"
# ADD THE "git add files" below:
# take the output from `git status' then do a search and replace on the leading
# `# modified: ' to change to `git add'
# of this kind of line:
# # modified: app/code/local/Amasty/Base/Block/Store.php
# to then become:
# git add app/code/local/Amasty/Base/Block/Store.php
git add /app/code/local/Mage/some/buggy/core/file
git commit -m "$MESSAGE"
git checkout master
git merge --no-ff $BRANCH
git branch -d $BRANCH
git push origin master