Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can GitHub show the history of changes made to one file in patch form?

If you do git log --patch -- path/to/file, you will get the history of the file along with a diff of all the changes made to it with each commit, like this:

$ git log --patch -- git-rebase.sh  commit 20351bb06bf4d32ef3d1a6849d01636f6593339f Author: Ramkumar Ramachandra <[email protected]> Date:   Sat Jun 15 18:43:26 2013 +0530      rebase: use 'git stash store' to simplify logic      rebase has no reason to know about the implementation of the stash.  In     the case when applying the autostash results in conflicts, replace the     relevant code in finish_rebase () to simply call 'git stash store'.      Signed-off-by: Ramkumar Ramachandra <[email protected]>     Signed-off-by: Junio C Hamano <[email protected]>  diff --git a/git-rebase.sh b/git-rebase.sh index d0c11a9..17be392 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -153,11 +153,8 @@ finish_rebase () {                 then                         echo "$(gettext 'Applied autostash.')"                 else -                       ref_stash=refs/stash && -                       >>"$GIT_DIR/logs/$ref_stash" && -                       git update-ref -m "autostash" $ref_stash $stash_sha1 || -                       die "$(eval_gettext 'Cannot store $stash_sha1')" - +                       git stash store -m "autostash" -q $stash_sha1 || +                       die "$(eval_gettext "Cannot store \$stash_sha1")"                         gettext 'Applying autostash resulted in conflicts.  Your changes are safe in the stash.  You can run "git stash pop" or "git stash drop" it at any time.  commit 2e6e276decde2a9f04fc29bce734a49d3ba8f484 Author: Ramkumar Ramachandra <[email protected]> Date:   Fri Jun 14 18:47:52 2013 +0530      rebase: use peel_committish() where appropriate      The revisions specified on the command-line as <onto> and <upstream>     arguments could be of the form :/quuxery; so, use peel_committish() to     resolve them.  The failing tests in t/rebase and t/rebase-interactive     now pass.      Signed-off-by: Ramkumar Ramachandra <[email protected]>     Signed-off-by: Junio C Hamano <[email protected]>  diff --git a/git-rebase.sh b/git-rebase.sh index d0c11a9..6987b9b 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -434,7 +434,7 @@ then                 shift                 ;;         esac -       upstream=`git rev-parse --verify "${upstream_name}^0"` || +       upstream=$(peel_committish "${upstream_name}") ||         die "$(eval_gettext "invalid upstream \$upstream_name")"         upstream_arg="$upstream_name"  else @@ -470,7 +470,7 @@ case "$onto_name" in         fi         ;;  *) -       onto=$(git rev-parse --verify "${onto_name}^0") || +       onto=$(peel_committish "$onto_name") ||         die "$(eval_gettext "Does not point to a valid commit: \$onto_name")"         ;;  esac 

I want to be able to get the same kind of format using GitHub's web interface (not the command line), and I want a link to send to someone else without the code.

like image 583
ma11hew28 Avatar asked Jun 01 '10 19:06

ma11hew28


People also ask

Does GitHub keep history?

On GitHub, you can see the commit history of a repository by: Navigating directly to the commits page of a repository. Clicking on a file, then clicking History, to get to the commit history for a specific file.

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.

Which git command is used to view the history of all the changes to a file?

Using git log --follow -p bar will show the file's entire history, including any changes to the file when it was known as foo .


2 Answers

The following URL will show all the commits for a single file in a format similar to git log -p:

http://github.com/<username>/<project>/commits/<branch>/<path/to/file>

...where:

  • <username> is the username of the person that owns the repo
  • <project> is the repo name
  • <branch> can be 'master' or any other branch
  • <path/to/file> is hopefully self-explanatory

Picking at (somewhat) random, here is an example from the vim-fugitive repo.

like image 80
Tim Henigan Avatar answered Oct 13 '22 06:10

Tim Henigan


Based on the answers above and my own attempts to find this exact feature, it appears the correct answer to this question is no.

Edit: before you down vote, maybe try and prove me wrong. Sometimes the correct answer isn't what you want to hear.

like image 31
jhk Avatar answered Oct 13 '22 05:10

jhk