GitHub可以显示修补程序形式对一个文件所做更改的历史记录吗? [英] Can GitHub show the history of changes made to one file in patch form?

查看:102
本文介绍了GitHub可以显示修补程序形式对一个文件所做更改的历史记录吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您执行 git log --patch - path / to / file ,您将得到文件的历史记录以及所有更改的差异它与每个提交,如下所示:

  $ git log --patch  -  git-rebase.sh 

commit 20351bb06bf4d32ef3d1a6849d01636f6593339f
作者:Ramkumar Ramachandra< artagnon@gmail.com>
Date:Sat Jun 15 18:43:26 2013 +0530

rebase:使用'git stash store'来简化逻辑

rebase没有理由知道关于隐藏的实现。在
中应用自动存储结果冲突的情况下,将finish_rebase()中的
相关代码替换为简单地调用'git stash store'。

签名:Ramkumar Ramachandra< artagnon@gmail.com>
签名:Junio C Hamano< gitster@pobox.com>

diff --git a / git-rebase.sh b / git-rebase.sh
索引d0c11a9..17be392 100755
--- a / git-rebase.sh
+++ b / git-rebase.sh
@@ -153,11 +153,8 @@ finish_rebase(){
然后
echo$(gettext'已应用')
else
- ref_stash = refs / stash&&
- >>$ GIT_DIR / logs / $ ref_stash&&
- git update-ref -mautostash$ ref_stash $ stash_sha1 ||
- die$(eval_gettext'不能存储$ stash_sha1')
-
+ git stash store -mautostash-q $ stash_sha1 ||
+ die$(eval_gettext无法存储\ $ stash_sha1)
gettext'应用自动静态导致冲突。
您的更改在存储中是安全的。
您可以随时运行git stash pop或git stash drop。

commit 2e6e276decde2a9f04fc29bce734a49d3ba8f484
作者:Ramkumar Ramachandra< artagnon@gmail.com>
日期:星期五6月14日18:47:52 2013 +0530

rebase:在适当情况下使用peel_committish()

在命令行中指定的修订为<到>和<上游>
参数的形式可以是:/ quuxery;所以,使用peel_committish()来
解决它们。 t / rebase和t / rebase-interactive
中的失败测试现在通过。

签名:Ramkumar Ramachandra< artagnon@gmail.com>
签名:Junio C Hamano< gitster@pobox.com>

diff --git a / git-rebase.sh b / git-rebase.sh
索引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_gettextinvalid upstream \ $ upstream_name)
upstream_arg =$ upstream_name
else
@@ -470,7 +470,7 @@
fi
;;中的情况$ to_name
*)
--to = $(git rev-parse --verify$ {to_name} ^ 0)||
+ to = $(peel_committish$ to_name)||
die$(eval_gettext不指向有效的提交:\ $ to_name)
;;
esac

我希望能够使用相同类型的格式GitHub的web界面(不是命令行),我想要一个链接发送给其他人,而不需要代码。

以下网址将以类似于 git log -p 的格式显示单个文件的所有提交:



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



...其中:


  • < username> ; 是拥有回购人的用户名

  • < project> 是回购商名称

  • < branch> 可以是'master'或任何其他分支
  • <$



采摘(at $ c $)< path / to / file> 有点)随机,这里是一个例子来自 vim-fugitive repo


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 <artagnon@gmail.com>
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 <artagnon@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

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 <artagnon@gmail.com>
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 <artagnon@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

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.

解决方案

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.

这篇关于GitHub可以显示修补程序形式对一个文件所做更改的历史记录吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆