7

I have a development repository and a deploy repository. When deploying code, a codebase is checked out of dev, rsync'd to the deploy working copy, and committed to the deploy repository. These repositories are therefore separate, but similar.

On dev, I have a branch. I would like to "apply" that branch to the deploy working copy. In other words, I would like to replay all commits on the branch (excluding merges) to the deploy repository (in one commit, if possible), or to take a diff between branch and master and apply it to the deploy working copy.

I think a similar svn command would be:

svn merge $SVN_REPO/trunk $SVN_REPO/branch/dev_branch deploy_dir

... where deploy_dir doesn't even need to be a working copy.

Is this possible?

Zombo
  • 1
  • 62
  • 391
  • 407
Tim Trinidad
  • 137
  • 1
  • 1
  • 6
  • 1
    Just add another remote repository and perform regular merge? – zerkms Jan 16 '13 at 03:34
  • There are a few repository anomalies that are complicating this, including an erroneous rebase. Trying a regular merge ends up with conflicts on almost every file. – Tim Trinidad Jan 16 '13 at 12:58

1 Answers1

19

One way is to fetch the branch from the other repo:

cd <deploy-path>
git remote add devel <devel-path>
git fetch devel

git cherry-pick devel/master...devel/branch  # Assuming your branch is based on master

Another way is to create a patch and then apply it:

git diff commitid1 commitid2 > something.patch
cd deploy
git apply something.patch
nishantjr
  • 1,788
  • 1
  • 15
  • 39