Git – How to Do a Git Merge Entirely Remotely

git

My team shares a "work" branch and a "stable" branch. Whenever a particular work branch is approved for further testing/release/etc, we merge it into stable. No code is ever checked directly into the stable branch.

Because of this, merge conflicts simply won't happen, and it seems silly to pull down the work branch and the stable branch, merge them, and then push the changes back. Is there a git command to ask a remote git server to commit a merge of two branches that it already knows about?

Best Answer

It's kinda in the nature of a DVCS that the action happens on a local machine, and gets pushed back to the main repo.

If it's that onerous, script it.

#!/bin/bash

if [ ! -f ".git" ]
then
  echo "Not in a git repo!" >&2
  exit 1
else 
  git checkout stable && \
  git pull origin stable && \
  git merge work && \
  git push origin stable
fi