Showing posts with label merge. Show all posts
Showing posts with label merge. Show all posts

Tuesday, September 19, 2017

Git force merge

Here is my scenario - I've development and release branches. And I want to merge my changes from development to release branch and if any conflicts during merge and I want to overwrite with the development branch changes.

$ git checkout release  => switch from development to release branch
$ git merge -X theirs development  => merge changes from development to release branch


Understand more about it here - https://stackoverflow.com/questions/40517129/git-merge-with-force-overwrite





Wednesday, October 21, 2015

How to merge the changes from your development branch to master/release branch

$ git checkout development
$ git merge -s ours release  //merge release into development and discard any changes on release branch
$ git checkout release
 $git merge development

Note: Very important point here is, we are completely discarding the changes which are made in release branch. Here we will just bring all the changes from development branch to release branch without having conflicts. If any conflicts during the merge it will take development changes and ignore the release changes if any.

This merge strategy can be used ONLY when you are sure that release branch does not have any additional git commits compared to development branch. 

If release branch is having specific commits and which are not there in development branch, then it's better to go always with the default merge strategy.

$ git checkout release
$ git merge development

Resolve any conflicts if any and commit it.