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,
Please sign in to leave a comment.
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?
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.
Simon, have you checked if Git root is defined properly in Settings | Version Control (as I wrote in #1 in my previous comment)?
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.
Please also check Git executable: Settings | Version Control | Git | Test : does it give correct answer?
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).
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?
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
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 ` � @ � @ � @
cd /Users/sim/Dropbox/Projets/Pryv/2012-Pryv/dev/
grep -r Bud1 */.git/refs
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...
Good points. Opened https://youtrack.jetbrains.com/issue/IDEA-133747 and https://youtrack.jetbrains.com/issue/IDEA-133749
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.
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.
Yes, you need to accept the agreement after Xcode update, see also Mac OSX: can't start Git after updating Mac OS/XCodeMac OSX: can't start Git after updating Mac OS/XCode.
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