git diff
git diff command is used to view changes in files between various states in your Git repository.
git diff ?
git diff ? git diff
a/aaa.txt The file version from the staging area (previous state).
b/aaa.txt The file version from the working directory (current state).
d9981b9 and dced72b are Git's internal hashes for the content before and after the change.
100644 is the file permission mode.
-1 means starting at line 1 of the old version.
+1,2 means starting at line 1 of the new version, with 2 lines in total.
- indicates a line from the old version that was removed.
+ indicate lines added in the new version.
git diff ? git diff
git diff --cached
git diff HEAD
git diff commit1 commit2
git diff filename.txt
git diff filename.txt git diff --cached filename.txt
git diff commit-hash
git diff branch1 branch2
git diff -w
git diff --stat
Your feedback helps us grow! If there's anything we can fix or improve, please let us know.
Weβre here to make our tutorials better based on your thoughts and suggestions.