1

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?

git bash status vs msys64 conflict

Luke
  • 1,623
  • 3
  • 24
  • 32
  • Can you edit your question to show what `git rev-parse --show-toplevel` outputs in each directory? – bk2204 Dec 18 '20 at 02:31
  • 1
    I believe git in MSYS2 sometimes gets confused about files that had changes to their line endings. You can try making a commit, and you'll probably find that those changes just disappear. You can also read about git options like `autocrlf`. – David Grayson Dec 18 '20 at 02:59

1 Answers1

4

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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    `core.autocrlf` should be considered deprecated. This repository - and all repositories - need `.gitattributes`. https://www.edwardthomson.com/blog/advent_day_1_gitattributes_for_text_files.html – Edward Thomson Dec 18 '20 at 09:47
  • 1
    @EdwardThomson Yes, I have said that for years on Stack Overflow. (like 2010: https://stackoverflow.com/a/2517442/6309) – VonC Dec 18 '20 at 10:00
  • 1
    I know! That’s why I was so surprised to read your answer! :D – Edward Thomson Dec 18 '20 at 10:27
  • 1
    @EdwardThomson My answer is simply to start and make sure `core.autocrlf` is set to false in both environment. Then we can move on to `.gitattributes` – VonC Dec 18 '20 at 10:28
  • it return `true` in Git Bash and nothing in msys2 (seem it's impicit that in msys2 core.autorlf = false) – Luke Dec 28 '20 at 06:36
  • 1
    @Luke Can you type `git config --global core.autocrlf false` in both sessions, then clone again your repository, and see if the issue persists? – VonC Dec 28 '20 at 10:07
  • @vonc it works identically now, thanks very much. – Luke Dec 29 '20 at 04:28