user798275
user798275

Reputation: 425

How to merge branches in git without actually merging?

I want to merge two branches, but all I want to do is to overwrite the file in master wherever it has changed.

I used to do this by checking out files one by one from the other branch, but that way I will lose the history once I delete the branch.

Any solution to that? Thanks!

Upvotes: 0

Views: 36

Answers (1)

lrineau
lrineau

Reputation: 6294

I think you could do:

git merge -s recursive -X theirs my_branch

That is almost what you asked for. The difference is that the result will be a merge of both branch, but in case of conflicts, the version of my_branch is chosen to resolve the conflict.

Upvotes: 1

Related Questions