简体   繁体   English

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

[英]Link to a specific (current) revision on GitHub

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?我该怎么做?

Just press y and the URL will change automatically to reflect the current version.只需按y ,URL 就会自动更改以反映当前版本。

Source 来源

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.浏览目录时:单击文件列表顶部的“最新提交 <refid>”链接,然后单击顶部附近蓝色区域中的“浏览代码”。
  • While viewing a file: Click on "History" and then on the "<>" button next to the refid to get a link.查看文件时:单击“历史记录”,然后单击 refid 旁边的“<>”按钮以获取链接。

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 git 克隆 git://github.com/ripper234/Test-grails-project.git
  • cd Test-grails-project cd 测试-grails-项目
  • git checkout c3110a562339a20eaa4c99e git 结帐 c3110a562339a20eaa4c99e
  • git branch 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... -> 不知道我理解对不对...

as mentioned in other answer - for latest commit y is the shortcut如其他答案中所述 - 对于最新提交y是快捷方式


for any commit对于任何提交

click on commits点击commits

在此处输入图片说明

and then click on code icon ( octicon-code )然后点击code图标( octicon-code

在此处输入图片说明

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. Select "Browse files"选择“浏览文件”

在此处输入图片说明

The URL format is as follows: https://github.com/USERNAME/REPO/blob/COMMITID/FILENAME URL格式如下: https : //github.com/USERNAME/REPO/blob/COMMITID/FILENAME

Replace the capitalised elements with details for your case用您的案例的详细信息替换大写元素

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM