0

I worked on master branch, and after the project was finished I created a branch X for the specific project. Now I have changed a lot in the master branch and want to move those changes to branch X as well.

I don't want to merge because merge would mean that changes in X would also be present after the merge right?

I want master and X to be exactly the same

user2071938
  • 2,055
  • 6
  • 28
  • 60

3 Answers3

0

If you want merge master and X-project branch by keeping only master version when conflicts raise you must use the theirs merge strategy :

# checkout out in X project branch and
git merge -s theirs master

You'll find more detail in the documentation of merge : http://git-scm.com/docs/git-merge

Samuel Dauzon
  • 10,744
  • 13
  • 61
  • 94
0

If you want master and X to be exactly the same and thereby drop all changes you made on X the easiest way would be to delete X and create a new one.

git checkout master
# the big 'D' means you want to delete an unmerged branch
git branch -D X
# create a new 'X'
git branch X
JDurstberger
  • 4,127
  • 8
  • 31
  • 68
0

Have a look at this answer https://stackoverflow.com/a/15943471/2418066.

For your case you should execute this:

git push origin +master:X
Community
  • 1
  • 1
jeerbl
  • 7,537
  • 5
  • 25
  • 39