I know how to merge modification using vimdiff, but, assuming I just know that the entire file is good to keep or to throw away, how do I do that?
I don't want to open vimdiff for each of them, I change want a command that says 'keep local' or 'keep remote'.
E.G: I got a merge with files marked as changed because somebody opened it under windows, changing the EOL, and then commited. When merging, I want to just keep my own version and discard his.
I'm also interested in the contrary: I screwed up big time and want to accept the remote file, discarding my changes.
git checkout {branch-name} -- {file-name}
This will use the file from the branch of choice.
I like this because
posh-git
autocomplete works great with this. It also removes any ambiguity as to which branch is remote and which is local. And--theirs
didn't work for me anyways.You can as well do:
to keep the remote file, and:
to keep local file.
Then
git add
them and everything is done.This approach seems more straightforward, avoiding the need to individually select each file:
or
Copied directly from: Resolve Git merge conflicts in favor of their changes during a pull
For the line-end thingie, refer to
man git-merge
:Be sure to add
autocrlf = false
and/orsafecrlf = false
to the windows clone (.git/config)Using git mergetool
If you configure a mergetool like this:
Then a simple
Will do the job
Using simple git commands
In other cases, I assume
should do the trick
Edit to do the reverse (because you screwed up):