是否有可能在 Github 本地桌面的特定提交中看到文件而不是差异?
Is that possible to see a file in a specific commit from Github desktop locally than the difference?
在 Gitlab/Github 中,如果我远程使用它,我可以在特定提交中下载文件,方法是转到提交并浏览该提交时的存储库。
如果我使用 windows 上的 Github 桌面和我 PC 上的存储库(不是将其推送到远程),我试图查看特定的提交,我只发现了不同之处版本。但是在那个特定的提交中无处可以看到整个文件。有什么方法可以做到吗?
后面跟着desktop/desktop issue 6535(对于二进制文件,或者实际上是任何其他类型)
从 2019 年开始:
The biggest problem here is that while we can easily display the diff of changes in a repository, opening a specific version of a file is not easy - either we'd need to checkout that commit so the working directory has that version, or we extract the specific version of the file to a temporary location, which the default program can then open.
Here's a rough flow I can think of that might achieve this:
- In "History" view, find a commit with an older version of the file you're interested in opening
- When the user clicks to perform the action, Desktop will extract the blob from the repository to the OS temporary directory, using a pattern like {SHA}-{filename} so that we can avoid clashes if the user looks at multiple versions of a file
- Once that file exists on disk, perform the existing behaviour of opening this new file in the default program
在命令行中,您可以使用 git show REVISION:path/to/file
or git cat-file -p <sha1>:./file.tex > wherever.tex
。
你的情况:
cd /mnt/c/Users/user/Documents/GitHub/test-b
git show e39...:test-b/1.txt
含义:git show
中的路径应该是存储库根文件夹中的路径,而不是OS完整路径。
OP Redzeń confirms in :
cd test-b,
# pwd: /mnt/c/Users/user/Documents/GitHub/test-b/test-b
git show e39...:1.txt
在 Gitlab/Github 中,如果我远程使用它,我可以在特定提交中下载文件,方法是转到提交并浏览该提交时的存储库。
如果我使用 windows 上的 Github 桌面和我 PC 上的存储库(不是将其推送到远程),我试图查看特定的提交,我只发现了不同之处版本。但是在那个特定的提交中无处可以看到整个文件。有什么方法可以做到吗?
后面跟着desktop/desktop issue 6535(对于二进制文件,或者实际上是任何其他类型)
从 2019 年开始:
The biggest problem here is that while we can easily display the diff of changes in a repository, opening a specific version of a file is not easy - either we'd need to checkout that commit so the working directory has that version, or we extract the specific version of the file to a temporary location, which the default program can then open.
Here's a rough flow I can think of that might achieve this:
- In "History" view, find a commit with an older version of the file you're interested in opening
- When the user clicks to perform the action, Desktop will extract the blob from the repository to the OS temporary directory, using a pattern like {SHA}-{filename} so that we can avoid clashes if the user looks at multiple versions of a file
- Once that file exists on disk, perform the existing behaviour of opening this new file in the default program
在命令行中,您可以使用 git show REVISION:path/to/file
or git cat-file -p <sha1>:./file.tex > wherever.tex
。
你的情况:
cd /mnt/c/Users/user/Documents/GitHub/test-b
git show e39...:test-b/1.txt
含义:git show
中的路径应该是存储库根文件夹中的路径,而不是OS完整路径。
OP Redzeń confirms in
cd test-b,
# pwd: /mnt/c/Users/user/Documents/GitHub/test-b/test-b
git show e39...:1.txt