1

I have two gits installed on my computer,

  1. One is used in babun(which is basically cygwin with a bunch of nice addons), the git is installed via pact install
  2. One is used in Command Prompt, it's the official git binary for Windows.

The interesting thing was, the commits made with babun's git didn't reflect on git for Windows. For example, for the same git repository, this is the result of babun's 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

This is the result of git for 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")

What could cause this? I need the result to be consistent because intellij can only work with native git, it couldn't see the changes I made with babun's git.

Searene
  • 25,920
  • 39
  • 129
  • 186

2 Answers2

4

The problem was that babun didn't process line endings correctly. The following line solved my problem.

git config --global core.autocrlf input
Searene
  • 25,920
  • 39
  • 129
  • 186
0

What could cause this?

Either ~/apps/med-prerate-general is not the actual same Windows path used by IntelliJ (ie you are looking at two different paths for the same remote repo)

Or ~/apps/med-prerate-general used its own .git folder located elsewhere (look for a GIT_DIR environment variable). And in that .git repo, .iml are not tracked and ignored. (check with a git check-ignore -v -- somefile.iml)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I think it's the same repository. I used `git rev-parse --show-toplevel` to check and the returned path pointed to the same directory, although they were not the same(Windows' version is `C:/Users/username/.babun/cygwin/home/username/apps/med-prerate-general` and babun's version is `/home/username/apps/med-prerate-general`. Could it be the reason that caused this? – Searene Oct 21 '16 at 06:56
  • @Searene If `/home` is `C:/Users/username/.babun/cygwin/home/`, then it should be the same local repo indeed. – VonC Oct 21 '16 at 07:05