LikeMyDog_22
LikeMyDog_22

Reputation: 5

why commit records local file without staging it?

I am new to git and try to execute examples to understand the staging process. I was reading many tutorials and my understanding was, that just the FileA that I have added before to the staging area (git add FileA) will be committed. But this does not happen, instead the file from my workdir will be committed, that I changed once again local right after I added the FileA to the stage area and without adding my changes again to the staging area.

What I did:

FileA

with

row1

already added and committed for first time. Fine!

Afterwards I changed this file by adding another row, to become

row1
row2

Now I add it this file to stage by

git add FileA

Now again I change this FileA local to become

row1
row2
row3

git status -s is telling me, that this file has been modified

git status -s
MM FileA.txt

Well if I commit it now, I did expect from reading that only the changes that are waiting in the stage-area are being committed and not the changes on my workdir. But this did not happen. Instead the changes from my local workdir are committed, so that I have

row1
row2
row3

Does anybody know about the reason?

Upvotes: 0

Views: 29

Answers (0)

Related Questions