Thursday, 27 December 2018

GIT: Keep a version of a file during a merge conflict

Merge conflict LARSSECONDARY"theirs parameter"LARSSECONDARY Merge conflict
LARSSECONDARY"ours parameter"LARSSECONDARY Sometimes if a conflict occurs the developer does not want to solve the conflict. He decides that he wants to keep the original version or the new version of the file.
For this, there is the --theirs and the --ours options on the git checkout command. The first option keeps the version of the file that you merged in, and the second option keeps the version before the merge operation was started.
git checkout --ours foo/bar.java
git add foo/bar.java
git checkout --theirs foo/bar.java
git add foo/bar.java

0 comments:

Post a Comment