Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View the change history of a file using github.com

Tags:

git

github

I've found this post about using the command line, but is it possible to view the file change history of a single file in a repository on github.com?

An in-browser solution would help me to better illustrate changes to team members while in meetings.

like image 987
propstm Avatar asked Jul 26 '13 18:07

propstm


People also ask

How do I see revision history in git?

Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.

Does GitHub keep history?

History goes back to when you started your project in Git. Doesn't matter when it was added to Github, Github just stores the repo. For example, here's one of my projects which predates Github by half a year.

Which command is used to view the history of the changes in git?

`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.


2 Answers

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 repository on GitHub:

https://github.com/mxcl/homebrew/commits/master/SUPPORTERS.md

To get a line-by-line history, simply add the SHA-1 string of the commit for which you want to see the diff to the URL after the word commit, and then anchor it with the filename you are interested in. For the same file above:

https://github.com/mxcl/homebrew/commit/288f001e924d5365b79c279e4478f372a04011ae#SUPPORTERS.md

like image 95
Burhan Khalid Avatar answered Oct 17 '22 21:10

Burhan Khalid


As @BurhanKhalid say, but here explaining as a "GitHub fast guide", with URL syntax:

  1. Browse your project at https://github.com/<USER>/<PROJECT> ...
  2. ... then you have a URL ending with the file path: https://github.com/<USER>/<PROJECT>/blob/master/<PATH>
  3. Now you have all, is only to change "blob/master" to "commits/master": https://github.com/<USER>/<PROJECT>/commits/master/<PATH>

PS: to remember "commits/master" click at the project's home in the "Commit" link.

Ops: there are a similar answer here, @TimHenigan expressed with http://github.com/<username>/<project>/commits/<branch>/<path/to/file>


Question to GitHub developers team

Why do you not offer a direct link for this kind of browsing? We need it, like Wikipedia readers need "history" link!


Ops, GitHub's team is listening to us?

Now (June 2014) when you browse through the folders, an icon appears, see "browse commits" above right. When you click, the tree/master URL turns commits/master.

Still missing to have the same for files, as showed here, but was an evolution.

like image 29
6 revs, 3 users 69% Avatar answered Oct 17 '22 19:10

6 revs, 3 users 69%