Show differences for a specific file or directory

suggest change
git diff myfile.txt

Shows unstaged changes to myfile.txt: the working tree compared with the index. If nothing is staged, that matches the difference from HEAD.

This also works for directories:

git diff documentation

The same comparison for every file under documentation/: unstaged changes only.

To compare the file in a commit with the copy in the working tree:

git diff 27fa75e myfile.txt

Or if you want to see the version between two separate commits:

git diff 27fa75e ada9b57 myfile.txt

To show the difference between the version specified by the hash ada9b57 and the latest commit on the branch my_branchname for only the relative directory called my_changed_directory/ you can do this:

git diff ada9b57 my_branchname my_changed_directory/

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents