Say I do
git add foo.txt
Now, foo's changes are in the index (I'm assuming git was already tracking that file). Now, when I do git diff, I can't see the changes in foo by doing
git diff
Are there some extra things that git diff
wants before it shows me those changes?
The Git index is a critical data structure in Git. It serves as the “staging area” between the files you have on your filesystem and your commit history. When you run git add , the files from your working directory are hashed and stored as objects in the index, leading them to be “staged changes”.
git whatchanged --diff-filter=A displays commits that added files, and the files they added, newest first. git whatchanged is a bit of an anachronism, you can use git log --diff-filter=A --stat or git log --diff-filter=A --numstat --pretty='COMMIT: %H %cd' for something more machine readable.
Looking up changes for a specific commit If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .
git diff
git diff --cached
git diff HEAD
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