While working on another file, I edited README.md
and then ran git add README.md
. When doing a git commit, I see that README.md
is both i
Where in .git could I look to see the authoritative state of this file?
Use git diff:
git diff -- yourFile
will give you the changes not yet staged (not yet added to the index)git diff --cached -- yourFile
will give you the changes already added to the index.See more at "Changes, not files":
Most version control systems work with files. You add the file to source control and the system tracks changes from that moment on.
Git concentrates on the changes to a file, not the file itself.
Agit add file
command does not tell git to add the file to the repository, but to note the current state of the file for it to be committed later.
See also "git add -p: The most powerful git feature you're not using yet"
Note that git status -v -v will soon (Git 2.3.4, Q2 2015) shows you both diffs (staged and unstaged), possible listing different diffs for the same file.
See "Show both staged & working tree in git diff?".