Setup p4merge as a diff tool for git
If you are already here, you probably know that p4merge is a really amazing tool for visualizing diffs. To set it up with git on an ubuntu system, simply do the following
- Download p4merge from their site.
- Copy it to a convenient directory. I usually copy to a file called programs
- Run the following commands
gunzip p4v.tgz tar xvf p4v.tar ln -s /path_to_your_folder/p4v-2014.2-123456/bin/p4merge /usr/local/bin/p4merge
That installs p4merge for you as a command line tool.
Now, to set it up with git, set the following config parameters
git config --global merge.tool p4merge git config --global mergetool.keepBackup false git config --global mergetool.p4merge.path /usr/local/bin/p4merge
From then on, to see diffs, you can run the command
to see diffs in the working dir vs staged or
git difftool --cached
to see diffs between staged and head.
In case you feel that you are annoyed by the prompts for each file, just set this config
git config --global mergetool.prompt false