Unable to set Meld as a diff tool in Git Bash - windows

Can someone help me to figure out how can I make Meld work on Git Bash for Windows 10? I have followed some instructions but neither worked for me.
After I typed these commands, nothing happened:
git config --global diff.tool meld
git config --global difftool.meld.path "/c/Program Files(x86)/Meld/Meld.exe"
git config --global difftool.prompt false
After using git difftool command, I get this weird error:
git config option diff.tool set to unknown tool: merge
Resetting to default...
This message is displayed because 'diff.tool' is not configured.
See 'git difftool --tool-help' or 'git help config' for more details.
'git difftool' will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld kompare gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare emerge vimdiff
2 files to edit.
I also tried;
/c/Progra~2/meld/bin/
"/c/Program files (x86)/Meld/"
"c:/Program files (x86)/Meld/"
My config file:
[user]
name = user
email = email#sample.com
[merge]
tool = meld
[mergetool "meld"]
cmd = meld --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\" --label \"MERGE (REMOTE BASE MY)\"
trustExitCode = false
[mergetool]
prompt = false
keepBackup = false
[diff]
guitool = meld
tool = meld
[difftool "meld"]
cmd = meld \"$LOCAL\" \"$REMOTE\" --label \"DIFF (ORIGINAL MY)\"
path = C:/Program Files(x86)/Meld/Meld.exe
[difftool]
prompt = false

Your path is not well written, and there is a missing space character.
And you should define cmd instead of path.
Eventually, this should work for you:
git config --global diff.tool meld
git config --global difftool.meld.cmd "\"C:/Program Files (x86)/Meld/Meld.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false
Edit:
If you want Git guidelines of valid tools, you can check it with:
git difftool --tool-help
Anyway, after our exchanges, you decided to use P4merge; This is a consequent update of my answer.
This is the way to setup it:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd "\"C:/Program Files (x86)/Perforce/p4merge.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global diff.tool p4merge
git config --global difftool.p4merge.cmd "\"C:/Program Files (x86)/Perforce/p4merge.exe\" \"\$LOCAL\" \"\$REMOTE\""

I'm also with Git Bash on Windows 10 and this config works fine with Meld :
diff.guitool=meld
merge.tool=meld
difftool.meld.path=C:/Program Files (x86)/Meld/meld/meld.exe
mergetool.meld.path=C:/Program Files (x86)/Meld/meld/meld.exe

Related

Why Git Bash vs msys2 git throw different git status?

Assume I have a git folder in /d/projects/project01.
When I do git status in Git Bash, and git status in msys2, it throws different output (image below)
Why this happen and you could I make those 2 work identically?
Check the output of git config core.autocrlf in both session.
If it is false in git bash, but not in mingw2, set it to false in the second mingw2 session:
git config --global core.autocrlf false

Changing Git core editor to Notepad++ causing issues

I use Windows 10 and a while back I changed the default Git editor to Notepad++
Now whenever I execute a command that brings up the editor I can't find any way of saving the message & continuing with the command - I end up having to cancel i.e. CTRL + C
I don't have to have Notepad++ as the editor but I do need to be able to use Git properly.
What I've tried
Restoring the original editor (I wasn't able to find out how)
Finding a similar problem on Stack Overflow
Restoring the original editor (I wasn't able to find out how)
You can try:
cd /path/to/your/repo
git config --unset-all core.editor
git config -l|grep core.editor
(grep is available if you add your <git>/usr/bin to the Windows %PATH%.
<git> is the path where you have installed git)
If that does not work, you might have to remove it for your local and global config:
cd /path/to/your/repo
git config --local --unset-all core.editor
git config --global --unset-all core.editor
git config -l|grep core.editor

Git (windows); P4merge as mergetool error

I've tried setting up p4merge as my mergetool, but I can't seem to get it working. Here's my commands:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
git config --global mergetool.p4merge.cmd "p4merge.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\""
And here's the error I'm getting:
I've also tried installing a portable version of git and running the commands from a windows cmd prompt and I still get a similar error.
Any ideas here? I'm stumped.
Edit
Strangely enough, after I've set up p4merge via git bash and it failed, I tried merging in Visual Studio's Team Explorer and it launched p4merge (tableflip). I imagine the command that kicks off via VS is similar to git bash, but I'm not sure how to correlate the two.
Edit 2:
Here's my git status showing my merge conflict status:
First, try those same config command form a regular cmd session (as I mentioned in "escape double quotes in git config from cmd").
Just make sure you have unzipped the latest git-for-windows
(PortableGit-2.8.3-64-bit.7z.exe) in, for instance, C:\git, and added C:\git\bin to your %PATH%.
Second make sure you have files that need merging, ie. that have unresolved merge conflicts (with merge conflict markers in them), in order for git mergetool to work.

Git mergetool with Perforce

I am using Perforce to resolve file conflicts in Git.
To set this up, I ran
git config --global mergetool.p4merge.cmd 'p4merge.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"'
git config --global merge.tool p4merge
p4merge is available in the path.
When I run git mergetool after conflicts have arisen, p4merge issues the following error message:
Errors: "./myfile.BASE.7132.example" is an invalid file
"./myfile.LOCAL.7132.example" is an invalid file
"./myfile.REMOTE.7132.example" is an invalid file
"myfile.example is an invalid file
It is not taking the complete path of the files like c:\users\abc\project\path\myfile.example but seems to think they are in the root directory.
I am working on Windows.
How can I make Perforce to take correct paths of the files?

Git replaced all of my LF with CRLF - How do I fix this?

I just ran a
git add -A
on my first git project.
I got back about a thousand responses:
"warning: LF will be replaced by CRLF"
as it went through each file (Ruby files, some are gems).
I deleted my .git directory and tried to disable this default setting by typing this command:
git config core.autocrlf false
Then I tried to add the files again:
git add -A
But I got the same result. Help!
You likely have the core.autocrlf attribute set to true
It's a configuration attribute you can set:
http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in
To make sure that is set to false for all Git projects you can do:
git config --global core.autocrlf false
Hope this helps!

Resources