How to tell git to accept all current change

Viewed 10916

So I was just trying to upload my code to git, I don't know what I did but somehow i'm in a bit of pickle.

Because there are so many conflicts in almost all of my files.

I don't want to resolve each conflict manually by going through each file because there are hundreds of files and there are multiple conflicts in each file.

So how do I tell git to accept all current changes but not the incoming changes or vice versa? Thanks

3 Answers
git checkout --theirs .
git add .

or

git checkout --ours .
git add .

So how do I tell git to accept all current changes but not the incoming changes or vice versa? Thanks

From the docs: https://git-scm.com/docs/git-checkout


You have to use merge strategies,

git checkout --ours / --theirs

When checking out paths from the index, check out stage (ours) or (theirs) for unmerged paths.


Short post:

http://gitready.com/advanced/2009/02/25/keep-either-file-in-merge-conflicts.html


Note by @j69

Be warned: checkout --ours and checkout --theirs erases all of the not-chosen edits in the file, even the ones outside the conflicts.

Related