Git Commit says no changed detected

Answered

Hi,

When I change a file and then select git | commit within Intelliji Idea it displays "No changes detected" message.  However, if I run git from the DOS prompt it shows the changes and allows me to commit my changes.  How can I fix this in Intellij?

Thanks,

3
15 comments

Hi Jerry,

1. Please check that your Git root is registered in Settings | Version Control.

2. Do you see your changes in Changes | Local toolwindow? If not, try to click the Refresh button there: does it help?

2

Same issue here with Intellij on OSX, both 13 and 14. I'm not sure, but I'd guess it started when I upgraded to OSX Yosemite.

In the Terminal tool window, the git command shows changes all right, but the VCS tools don't pick up anything: edited files show just as if no changes were made, no change detected upon committing, etc.
When I open the Changes | Local window, there's a red error message at the bottom which suggests the VCS tools aren't looking in the right place (or with the right environment):

Error updating changes: fatal: not a git repository (or any of the parent directories): .git  during executing git status --porcelain -z --untracked-files=no -- .

Advanced thanks.

0

Simon, have you checked if Git root is defined properly in Settings | Version Control (as I wrote in #1 in my previous comment)?

0

Yes I did, all my modules' directories are registered as VCS (Git) roots.
It had all been working fine until recently, probably when I upgraded OSX from Mavericks to Yosemite. I then upgraded Intellij to v14 to try and see whether it'd fix anything, which it didn't.

0

Please also check Git executable: Settings | Version Control | Git | Test : does it give correct answer?

0

Yes the git command looks all fine. Both Path to Git executable in Settings | Version Control | Git and which git in the terminal point to /usr/local/bin/git (git version 1.8.5.3).

0

Do you experience problems only with getting file statuses, what about other Git commands?

Could you please attach a screenshot of Settings | Version Control as well as your log file (Help | Show Log) right after you reproduce the issue?

0

Only status and diff seem affected. I can explore branches and log (history) all right.

Screenshot and logfile are attached... thanks for your help.



Attachment(s):
Settings, Version Control.png
idea.log.zip
0

Could you please check if the api-server-common repository is set up correctly: the log mentions the following problem:
    .git/HEAD file not found in /Users/sim/Dropbox/Projets/Pryv/2012-Pryv/dev/api-server-common/.git
Which usually indicates an incorrectly registered repository.

Another error that I see is the following:
    bad hash string: Bud1   %           @ �           @ �             @ �             @   E%  DSDB  ` �            @ �             @ �             @

It means that some Git reference file in .git/refs/ contains not a hash, but some other data. Unfortunately, the error doesn't show which repository has this problem. Can you search for this problematic reference file and remove it (or at least temporary move to debug the problem)? You may try the following query in Terminal to make a search among all your repositories (I assume, they are located in one common folder):

     cd /Users/sim/Dropbox/Projets/Pryv/2012-Pryv/dev/
    grep -r Bud1 */.git/refs

0

That was it: the files in repo api-server-common (which I wasn't working on) were corrupted; I guess my files sync is to blame. As soon as I reset that repo Intellij resumed picking changes properly.
I didn't imagine that another repo was preventing me to see my changes.

Thanks Kirill!

To help avoid that in the future I suggest that you...

  1. display the error as such when trying to commit changes, instead of silently ignoring it and just saying "No changes detected" (and the error only being visible in the changes tool window)
  2. include the repo name in the error message (had I seen what repo it was about I'd probably have been able to fix the issue)
0

sgz wrote:
 
To help avoid that in the future I suggest that you...

  1. display the error as such when trying to commit changes, instead of silently ignoring it and just saying "No changes detected" (and the error only being visible in the changes tool window)
  2. include the repo name in the error message (had I seen what repo it was about I'd probably have been able to fix the issue)


Good points. Opened https://youtrack.jetbrains.com/issue/IDEA-133747 and https://youtrack.jetbrains.com/issue/IDEA-133749

0

I had the same issue when I updated mac OS X to HighSierra.

I did git test on Preferences > Version Control > Git and it's error.

So, I checked Xcode then there is no Xcode.

I installed Xcode and the problem solved!

Thank you.

1

In my case, IDEA version console shows need to sign XCode agreement

➜ ~ sudo xcodebuild -license
Password:


You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

Apple Inc.

0

UPDATE:
since latest git update (2.35.3 )  i run into the same issue using PHP Storm on Windows on a mounted WLS2 repository:
got message: Unsafe repository: 
git config --global --add safe.directory '%(prefix)///wsl$/Ubuntu/home/ubuntu/<path-to-repository/>'

Running that command added a new line to the local windows .gitconfig file and has to be repeated for all submodules.... 
after restarting phpstorm this now works 

0

Please sign in to leave a comment.