0

I am using a side-branch called live-deploy - for automated deployment on the server - and the master branch as main work-branch.

When something is ready to be tested live i will just overwrite the branch. The Problem is that i can't just reset it to master because the automated scripts can throw errors when i do that.

Now i tried to merge the branches using the ours strategy, i got that from this question: How do I 'overwrite', rather than 'merge', a branch on another branch in Git?

git checkout master
git merge -s ours live-deploy

No errors and git tells me everything is fine but nothing happened in the live-deploy branch. For example, there was a line i removed in master and was still there in live-deploy. After the merge nothing changed.

Shouldn't it be the same in both branches now? I have the feeling i do it the wrong way. Is there another way without using:

git checkout live-deploy
git reset --hard master
Community
  • 1
  • 1
Chris
  • 2,069
  • 3
  • 22
  • 27
  • You would want to merge the other way around and make sure you're checked out on live-deploy. And in that case, you'll want ``git merge -s recursive -X theirs master`` to show preference towards the master branch. – Jeff Jul 21 '15 at 11:44
  • @jeff There's a difference between the `ours` strategy (which takes the whole `ours` tree) and the `recursive` strategy, which merges the trees and uses the `theirs` side in the case of a conflict. – Edward Thomson Jul 21 '15 at 13:02

0 Answers0