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

时间:2016-10-21 06:32:41

标签: git intellij-idea cygwin babun

我的计算机上安装了两个gits,

  1. 一个用于babun(基本上是带有一堆好插件的cygwin),git是通过pact install安装的
  2. 一个用于命令提示符,它是Windows的官方git二进制文件。
  3. 有趣的是,用babun的git做出的提交没有反映出Windows的git。例如,对于相同的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
    

    这是Windows的git的结果

    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所做的更改。

2 个答案:

答案 0 :(得分:4)

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

git config --global core.autocrlf input

答案 1 :(得分:0)

  

是什么导致这个?

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

~/apps/med-prerate-general使用位于其他位置的自己的.git文件夹(查找GIT_DIR环境变量)。在.git个仓库中,.iml未被跟踪和忽略。 (查看git check-ignore -v -- somefile.iml