Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In a git merge, how do you just replace your version with the version git says there is a conflict with?

Tags:

git

merge

I have two files: A and B. If I have been working on A and a partner is working on B, I want to merge files A and B. B is already committed. Let's say my partner already made the changes I was working on, so I just want to replace my A file with their B file - no merge needed. How do I resolve the conflict with git?

Thanks!

like image 207
FinDev Avatar asked Aug 18 '10 18:08

FinDev


1 Answers

If their is a conflict during a merging operation (merge, cherry-pick, rebase, etc...) you can resolve conflict by picking one side of the changes by doing :

git checkout --ours <path> (this will choose the local changes)

or

git checkout --theirs <path> (this will choose the remote changes)

then finishing resolving the conflict as usual with:

git add <path> 

then commit with:

git commit 
like image 172
Droopycom Avatar answered Oct 03 '22 12:10

Droopycom