I would expect git diff
to work like git add
and others, in being able to do something like
git diff **/models.py
rather than having to do
git diff /full/path/to/my/python/file/called/models.py
It's strange though because
git commit **/models.py
git add **/models.py
both work as you'd expect.
In answer to the original question, git diff isn't showing anything because you have a brand new directory, with a newly added file, but there are zero changes in the file for git diff to show. git status is showing that you added a new file, but git diff is for showing changes within files.
The git diff command returns a list of all the changes in all the files between our last commit and our current repository. If you want to retrieve the changes made to a specific file in a repository, you can specify that file as a third parameter.
with the path from the repository root to your current directory in the working tree. For example: cd ~/my-git-repo/dir1/dir2 git show abcd123:./Makefile # equivalent to git show abcd123:dir1/dir2/Makefile.
git-diff-tree - Compares the content and mode of blobs found via two tree objects.
git diff [options] [<commit>] [--] [<path>...]
Example
git diff -- */models.py
http://kernel.org/pub/software/scm/git/docs/git-diff.html
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