user5858 user5858 - 1 year ago 123
Git Question

git reset HEAD file touches many other files too

I've been using git for a couple of years and after adding a file using "git add" we can unstage it using command "

git reset HEAD file1 file2

This command is even specified when we try to commit changes:

(use "git reset HEAD ..." to unstage)

To my understanding it only unstages the specified files and do nothing else.

Today I gave this command

git reset HEAD a.php test.php #to unstage some left over test files

after running it it generated lot of warnings like

M public/
M public/
M public/
M public/
M public/
M public/
M public/
M public/
M public/

This answer confirms what I understand Does `git reset HEAD file` also check out the file? but why it always show lot of warnings which seem to be that those
files have been modified.

Can anyone explain me this threatening what "
" means and why it should be even listing such warnings?

Answer Source

M means that the working version of the file and the version you have in your last commit are different. You can check where differences are using git diff <namefile> The command you ran only unstage files. The most probable explanation is that you had all those modified files also before running your git reset command. Maybe those files are generated/created by the application you are working on...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download