简体   繁体   中英

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM