Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view the changes in a single file in GitHub?

Tags:

git

github

My last commit updated ~300 files, and the diff page says Sorry, we could not display the entire diff because it was too big and is so slow that I can barely scroll it. How can I see changes for a single file?

When viewing a specific file, I expected to have a link to compare it with the previous version, but I can't find any. Am I missing something or why isn't such an important feature there?

like image 844
riv Avatar asked Jul 16 '15 14:07

riv


1 Answers

Use git diff. It can take revision and file arguments.

git diff master ./myawesomefile.txt 

will show how master's version of the file differs from your local version

git diff 878a984e ./myawesomefile.txt

will show how commit hash 786876 differs from your current local version

git diff 878a984e 48d74774 ./myawesomefile.txt

will show how commit hash 878a984e version of myawesomefile.txt differs from 48d74774

like image 95
iphipps Avatar answered Oct 07 '22 23:10

iphipps