My use case is this...
I have a project that has two production branches. Most changes in any branch need to be merged into the other branch. It is only very specific and infrequent changes that need to be kept separate in the two branches.
What I want to do is to set up an automatic merge between two branches on the main remote repository that is used as the source for the production build machines so that anyone who pushes something into branch A automatically merges it into branch B and handling a special not-to-be-merged push (which happens infrequently) manually.
Any easy way to do this?
You could use a post-receive git hook. When someone pushes to the main remote repository, a script is invoked (the hook) where you get various sorts of information, what ref what pushed, preview commit hash and new commit hash.
Here you can determine exactly what branch was pushed. Given this information you could in another repository checkout the other branch, do the merge and push up this information.
There is a post-receive.sample file in your .git/hooks/ folder. Rename it to post-receive and make sure it's executable. In bash it could look like:
#!/bin/sh
# <oldrev> <newrev> <refname>
while read oldrev newrev ref
do
echo "$oldrev $newrev $ref"
done