Babun 的 git 和 Windows' git 不能一起工作

Babun's git and Windows' git don't work together

我的电脑上安装了两个 git,

  1. 一个用于 babun(基本上是带有一堆不错的插件的 cygwin),git 通过 pact install
  2. 安装
  3. 一个用于命令提示符,它是 Windows 的官方 git 二进制文件。

有趣的是,使用 babun 的 git 进行的提交并没有反映在 git 上 Windows。例如,对于相同的 git 存储库,这是 babun 的 git.

的结果
git status                                                                       ~/apps/med-prerate-general
On branch dev
Your branch is ahead of 'origin/dev' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

这是 git 对于 Windows

的结果
git status
On branch dev
Your branch is ahead of 'origin/dev' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   somefile.iml

no changes added to commit (use "git add" and/or "git commit -a")

这可能是什么原因造成的?我需要结果是一致的,因为 intellij 只能使用原生 git,它看不到我用 babun 的 git.

所做的更改

What could cause this?

要么 ~/apps/med-prerate-general 不是 IntelliJ 使用的实际相同 Windows 路径(即您正在查看同一远程仓库的两个不同路径)

~/apps/med-prerate-general 使用位于别处的自己的 .git 文件夹(寻找 GIT_DIR 环境变量)。在那个 .git 回购中,.iml 没有被跟踪和忽略。 (检查 git check-ignore -v -- somefile.iml

问题是 babun 没有正确处理行尾。下面一行解决了我的问题。

git config --global core.autocrlf input