GitHub에서 한 파일의 변경 내역을 패치 형식으로 표시 할 수 있나요?

을 수행하면 다음 git log --patch -- path/to/file과 같이 각 커밋에 대한 모든 변경 사항의 차이점과 함께 파일 기록을 얻을 수 있습니다.

$ 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

GitHub의 웹 인터페이스 (명령 줄이 아님)를 사용하여 동일한 종류의 형식을 얻고 싶고 코드없이 다른 사람에게 링크를 보낼 수 있기를 원합니다.



답변

다음 URL은 다음과 유사한 형식으로 단일 파일에 대한 모든 커밋을 표시합니다 git log -p.

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

…어디:

  • <username> 저장소를 소유 한 사람의 사용자 이름입니다.
  • <project> 저장소 이름입니다.
  • <branch> ‘마스터’또는 다른 분기 일 수 있습니다.
  • <path/to/file> 자명하다

(다소) 무작위로 선택하면 vim-fugitive repo 의 예가 있습니다 .


답변

위의 답변과이 정확한 기능을 찾으려는 내 자신의 시도를 바탕으로이 질문에 대한 정답은 ‘ 아니요’ 인 것으로 보입니다 .

편집 : 당신이 투표하기 전에, 어쩌면 내가 틀렸다는 것을 증명하십시오. 때로는 정답이 듣고 싶은 것이 아닙니다.


답변

GitHub의 인터페이스를 사용하는 직접 URL 답변 (BTW가 완벽하게 정확함)의 대안은 다음과 같습니다.

  • ‘소스’보기를 클릭하십시오.
  • 원하는 지점으로 전환
  • 파일의 실제 소스보기가 나올 때까지 원하는 파일을 찾으십시오.
  • 오른쪽 상단의 ‘기록’을 클릭하십시오.


답변

Linux를 사용하는 경우 TIG 를 다음 과 같이 설치하십시오 .

sudo apt-get install tig

그리고,

tig 경로 / 대상 / 파일 /

모든 커밋과 각각의 변경 사항을 보여줍니다.

탈랏 파 베즈


답변