I am using git repository. Everything is working properly except git diff command. Whenever I modify any file then git diff command showing entire file is modified even though I modified small portion of the code.
What could be the reason git diff showing entire file modified instead of small portion of the code? Also let me know setting of git diff configuration.
diff --git a/application/routes.php b/application/routes.php
index 2842f8d..6629d16 100755
--- a/application/routes.php
+++ b/application/routes.php @@ -1,671 +1,676 @@ -<?php -/** - * Set the routes. Each route must have a minimum of a name, a URI and a set of - * defaults for the URI. - / -?> +<?php +/* + * Set the routes. Each route must have a minimum of a name, a URI and a set of + * defaults for the URI. + */ +?>
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.
You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.
Comparing changes with git diff Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.
The git diff command shows the differences between the files in two commits or between your current repository and a previous commit.
Compare the output of git diff
and git diff -b
. Whitespace may be to blame. Reflowing text might be another (you didn't mention what you were storing).
The file is either stored in unix mode or windows mode (with different line endings) and when you save the file you save it in the opposite format.
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