I recently went from two people developing one project in one repo to having many developers working in one repo and we copy tested commits to the production repo.
We are often encountering git errors copying the commits from one repo to the other.
This is the script I use to copy a commit from the development repo to the production repo:
[ "$1" == "" ] && echo "must specify SHA" >&2 && exit 1
# To sync commits from dev to production
# First switch to the dev code directory:
cd /root/cg-dev
# arg is a hash of the commit you want to sync via "git log" (or other git commands)
SHA=$1 && \
cd /root/cg && \
git --git-dir=/root/cg-dev/.git \
format-patch -k -1 --stdout $SHA | \
git am -3 -k --ignore-whitespace
# Then you need to push changes to the dev server:
git push origin master
Below is a git error that we frequently have been getting when executing that script.
Often the problem goes away by re-committing the code under new branches, but this takes too long.
We want to fix the problem in our procedure and eliminate these.