
This is to arrange our window layout ( wincmd J to place the first window downward). Then inside our shell/bash script, some rearrangement is done. Vimdiff -c "wincmd J" -c "windo set wrap" "$4" "$3" "$1" "$2"Īccording to git mergetool - Options, git will send in arguments in order of $BASE, $LOCAL, $REMOTE, and $MERGED respectively in which we pass in from our accordingly. # script to accept arguments sending in from git mergetool Add the following content into such file via your favorite text editor.This will set our customized merge tool namely gitmergetool to execute the command as set. git config -global "gitmergetool \"\$BASE\" \"\$REMOTE\" \"\$LOCAL\" \"\$MERGED\""Įscape $ in order to not let terminal interpret it as environment variable (if executed on Unix/Linux based terminal).git config -global merge.tool gitmergetool.This command will set to show in diff3 style. So when there is a merge conflict, conflict chunks will only show in diff2 format which might not be enough.
#Merge tool p4merge how to#
Note that we are not going to talk about how to use it here, but just setup. Please read on.Ī guide below is to set up your merge tool to use vimdiff with git, and perforce ( p4.exe/ p4 binaries).

Then the information listing here might not be too attractive to you. If you use GUI merge tool, and you probably are happy with it. More full-fledge 3-way merge is needed in this case.
#Merge tool p4merge code#
This is result from too deviated away, and much of work has been done around the same lines of code in two different branches. Sometimes automatic merge mechanism results in a mess state that is totally hard to guess which chunk either from base, yours or theirs version should be picked? You know, sometimes chunk of codes just cut, and inserted out of nowhere. Then to-be-merge-result of E would require much of effort.

Imagine if changes from A to (B, C) deviates itself very far if compared to changes from A to D.

With the help of colorizing diff between each version, this would reduce time and reduce number of guesses from the one who would be merging. It’d be so helpful to see content in base, yours and theirs version. Perforce 3-way linear diff format (by default)īut in a more complicated case, it is not enough to just take a look only at a linear 3-way diff format above. cab9282 is just an example of SHA1 for git hash. Git 3-way linear diff format (need git config -global nflictstyle diff3). Most of merge conflicts I have resolved can be easily done by looking at a linear 3-way diff view alone without a need to look at each separate content of each file.Ī linear 3-way diff (that I’d like to say) is as follows > feature_branch Encountering a situation to resolve a merge conflict that is harder than usual as well as taking longer time won’t come in very often.
