How to view the changes in a single file in 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?
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
I think you're looking for this cheatsheet. You can compare across time like this link does with master@%7B2015-02-27%7D...master
in the end or across commits for specific files like this one does with ^
after the base you want to compare.
I tend to do this all locally using git fetch master && git diff ..master
to compare my current branch to an updated master, but you certainly can do this with the above.
You can view the change history of a file by clicking on the history button, or by adding commits
to the url of the file. Here is what it looks like for a file at the homebrew repo on github.
eg
https://github.com/mxcl/homebrew/commits/master/SUPPORTERS.md
Or you can try:
On GitHub, there are, essentially, two different ways to see the commit history of a repository:
By navigating directly to the commits page of a repository.
By clicking on a file, then selecting History, to get to the commit history for a specific file.
For more information on how Git considers commit history, you can read up on the "History Simplification" section of the [git log][2] help article.
链接地址: http://www.djcxy.com/p/22676.html