GIT – Keep files when merge conflict

With Git, sometimes you need merge between branches.  For example, you need merge BranchB to BranchA. Almost cases, if it has conflicts, you will open the conflict file and merge it manually. But in some cases, you have to keep file at either BranchA or BranchB. Fortunatly, “git checkout” command with options will help you do that.

To merge between 2 local branches:

Or merge a remote branch to a local branch:

To keep the file that we own:

To keep the file that they own:

In case you have too many files conflicted, you can use the command below: