git GitHub 上特定(当前)修订版的链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4004860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:40:12  来源:igfitidea点击:

Link to a specific (current) revision on GitHub

gitgithub

提问by ripper234

Here is a sample project on github: http://github.com/ripper234/Test-grails-project

这是 github 上的一个示例项目:http: //github.com/ripper234/Test-grails-project

I would like to capture the latest revision, and send a link to it to someone, so that even if the project changes later he will see the specific revision I was talking about. I guess forking could do that, but it's overkill.

我想捕获最新的修订版本,并将其链接发送给某人,这样即使项目稍后更改,他也能看到我正在谈论的特定修订版本。我想分叉可以做到这一点,但它是矫枉过正。

How do I do that?

我怎么做?

采纳答案by Tim ?as

To access a single file or directory:

要访问单个文件或目录:

  • While browsing directories: Click on the "latest commit <refid>" link at the top of the file list, and then "Browse code" in the blue area near the top.
  • While viewing a file: Click on "History" and then on the "<>" button next to the refid to get a link.
  • 浏览目录时:单击文件列表顶部的“最新提交 <refid>”链接,然后单击顶部附近蓝色区域中的“浏览代码”。
  • 查看文件时:单击“历史记录”,然后单击 refid 旁边的“<>”按钮以获取链接。

回答by Anmol Singh Jaggi

Just press yand the URL will change automatically to reflect the current version.

只需按下y,URL 将自动更改以反映当前版本。

Source

来源

回答by udo

let's say you would like that the someone you send this link

假设您希望发送此链接的人

has to work on the resulting code of this commit.

必须处理此提交的结果代码。

he would do this:

他会这样做:

  • git clone git://github.com/ripper234/Test-grails-project.git
  • cd Test-grails-project
  • git checkout c3110a562339a20eaa4c99e
  • git branch c3110a562339a20eaa4c99e
  • git 克隆 git://github.com/ripper234/Test-grails-project.git
  • cd 测试-grails-项目
  • git 结帐 c3110a562339a20eaa4c99e
  • git 分支 c3110a562339a20eaa4c99e

now the user has a branch with the code of the mentioned commit.

现在用户有一个包含上述提交代码的分支。

does this answer your question? -> not sure if I understood it right...

这回答了你的问题了吗?-> 不知道我理解对不对...

回答by bhv

as mentioned in other answer - for latest commit yis the shortcut

如其他答案中所述 - 最新提交y是快捷方式



for any commit

对于任何提交

click on commits

点击 commits

enter image description here

在此处输入图片说明

and then click on codeicon (octicon-code)

然后点击code图标(octicon-code

enter image description here

在此处输入图片说明

回答by toraritte

To show the state of the project at a specific commit:

要在特定提交时显示项目的状态:

https://github.com/<user>/<project>/tree/<commit-hash>

https://github.com/<user> /<project> /tree/<commit-hash>

For example:

例如:



The easiest way without editing the URL is:

不编辑 URL 的最简单方法是:

  1. Choose a commit (either the latest or from the list of commits)
  1. 选择一个提交(最新的或从提交列表中选择)

enter image description here

在此处输入图片说明

  1. Select "Browse files"
  1. 选择“浏览文件”

enter image description here

在此处输入图片说明