Here are the git commands which I have typed
$ git add -u -n
add 'proj1/Foo.scala'
$ git add .
$ git add .
$ git commit -m "message"
On branch feature/branch
Your branch is up-to-date with 'origin/feature/branch'.
Changes not staged for commit:
    modified:   ../proj1/Foo.scala
So why did I get the Changes not staged for commit? as you can see that I did git add . twice
Now if I got ahead and do
git add ../proj1/Foo.scala
and then do commit it works. Why should I do each file specifically rather than just do git add .
git add . by default will add files changed in current working directory and its subdirectories only.
If you want to add all files, use git add -A (this works in the latest versions of git).
Alternatively, as pointed by @Zak in comments, you can use git commit -am "commit message" to do this in a single step.
I had a similar problem when git add <filename> did not work.
I cd down to the directory and did git add there and file was added as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With