Git Visual Diff and Merge Tools
-
Install p4merge for windows
-
configure git git config --global merge.tool p4merge git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe" git config --global diff.tool p4merge git config --global difftool.p4merge.path "C:/Program Files/Perforce/p4merge.exe" git config --global difftool.prompt false git config --global mergetool.prompt false
-
To see the diff using p4merge git difftool
-
To see diff between working directory and last commit git diff HEAD git difftool HEAD
-
To see diff between staging area and last commit git diff --staged HEAD (HEAD means last commit in current branch)
-
To see diff between two commits git diff commit-hash commit-hash git diff HEAD HEAD^ (HEAD → means top commit, HEAD^ → top commit minus 1) git difftool commit-hash commit-hash (difftool will show one file at a time, press q to close it and open the next diff file )
-
To see diff between local repo and remote repo git diff master origin/master