Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git diff in summary?

Tags:

git

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?

like image 378
Justin Moh Avatar asked Jun 02 '16 03:06

Justin Moh


People also ask

How do I see git diff?

You can run the below commands to compare the changes for specific file: git diff HEAD <file_name> git diff <file_name>

What is git diff format?

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.”

Why is git diff not showing?

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.

What does ++ mean in git diff?

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.


1 Answers

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)

like image 194
Tony Vincent Avatar answered Sep 20 '22 20:09

Tony Vincent