I'm new to Git and use Git Bash locally. I have an issue when committing.
As I learned, changes are only committed after they have been staged via add (unless you are using commit -a). But in contrast, I face the following scenario:
I add a file test.txt: git add test.txt
After that, I do some changes locally to this file without a further add.
git status shows me - still as expected - changes to be committed and changes not staged for commit.
So far so good, but now it's getting irritating: I do a git commit -m "commit only staged changes" test.txt
But as a result, my local changes are committed as well.
Also, git statusnow only says "nothing to commit, working tree clean".
Can anybody explain to me, what needs to be done that only the staged changes are committed (what I actually understood as default behaviour...)? Thanks a lot in advance!