Why Git Bash vs msys2 git throw different git status? - bash

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

Related

'git status' yields different results in git bash (Windows 10) an WSL2 bash

I work on Windows 10 with WSL2. I initialized a git repo in git bash (Windows) and everything works fine (commit, push etc.).
git status # on Windows, git bash
When I switch to WSL2 and have a look at the same status of the same repo (drive mounted in WSL), I find that all files are untracked (WSL2 bash).
git status # same repo in WSL2 bash
My Questions:
Why does this happen?
Is there a way to avoid this and achieve consistency across both OS (i.e. without cloning into a separate repo in WSL)?
you might find some answers here
TLDR : git config --global core.autocrlf true

Unable to set Meld as a diff tool in Git Bash

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

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.

Xcode upgrade gives "warning: push.default is unset" when doing a git push

I have been using git for some time and it was working fine on my repository. However, I upgraded to XCode 7 recently and now when I try to do a git push <branch>, I get the following error message:
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
fatal: 'Develop_New_Car' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have git version 2.3.3
and running which git gave me /usr/local/bin/git
A git config --global push.default simple should be enough, but XCode7 might not be looking for the global setting in the same place ($HOME) as before.
In that case, try at least to set that config locally in the repo managed by XCode7:
cd /path/to/my/git/repo
git config push.default simple

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