With git pull
, it shows a diff summary like this:
Updating 6a78751..811f788 Fast-forward app/Http/Controllers/SaleController.php | 7 +- .../views/pages/sale/create.blade.php | 137 +++++++++++++--- resources/views/pages/sale/index.blade.php | 4 +- resources/views/pages/sale/show.blade.php | 5 +- 4 files changed, 123 insertions(+), 30 deletions(-)
Is there a way to use commands like git diff
to get similar output?
You can run the below commands to compare the changes for specific file: git diff HEAD <file_name> git diff <file_name>
According to the official Git documentation, git diff is used to: “Show changes between the working tree and the index or a tree, changes between the index and a tree, changes between two trees, changes resulting from a merge, changes between two blob objects, or changes between two files on disk.”
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.
When viewing a combined diff, if the two files you're comparing have a line that's different from what they were merged into, you will see the ++ to represent: one line that was added does not appear in either file1 or file2.
git log --stat
will show the amount each file was changed.
git whatchanged
gives some detail into the files that were modified.
git diff --stat <sha1> <sha2>
gives the files and the amount of changes between two commits.
git diff --stat <branch>
to compare to another branch (e.g. master)
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