在GitHub中,是否有一种简单的方法可以导航到大型开源项目的最早提交?
到目前为止,该项目已经提交了超过13000次。我不想在提交历史页面上无数次地按下“旧”按钮才能到达最初的提交(或第一次提交)。
在GitHub中,是否有一种简单的方法可以导航到大型开源项目的最早提交?
到目前为止,该项目已经提交了超过13000次。我不想在提交历史页面上无数次地按下“旧”按钮才能到达最初的提交(或第一次提交)。
当前回答
在项目页面单击选项卡Insights > contributor。 选择直方图的开头。 单击提交号。 完成了。
PS -画一个小范围得到一个单一的页面。
其他回答
你可以使用init bookmarklet导航到GitHub存储库的第一次提交。
INIT A bookmarklet to quickly get you to the first commit of a repo. Overview Being able to quickly navigate to the oldest commit in a repo is quite helpful. Go ahead and drag the bookmarklet (link) onto your bookmark bar and click it whenever you'd like to go to the first commit of a repo. Usage Go to any particular repo's landing page (e.g. like the one you're on) and click the bookmarklet, which will take you to the first page (initial commit). By default, it tracks the master branch, but if you change the branch on the landing page, it will go to that branch's first commit. Retrieved from README.md on GitHub
免责声明:在发布这个答案前几分钟,我对init进行了一个小的自述更新。
你可以通过下面的代码进入提交的第一页,我把它作为一个代码片段保存在Chrome开发工具中。
function githubFirstCommitsPage() {
let el = document.querySelector('.repository-content');
let commits = el.querySelector('[aria-label^=Commits]');
let base = commits.closest('a').href;
let count = commits.previousElementSibling
.textContent
.trim()
.replace(/[^\d\.\-]/g, "");
count = count-36;
let sha = el
.querySelector('[data-test-selector="commit-tease-commit-message"]')
.href
.split('/');
sha = sha[sha.length-1];
window.location = `${base}?after=${sha}+${count}`;
}
githubFirstCommitsPage();
这个链接提供了一个在GitHub上做这件事的UI方式。简介:
“见解”选项卡 网络选项卡(左侧) Shift + <——
克隆存储库,用命令行打开并运行$ git log——reverse
这将以相反的顺序显示提交。
一旦你有了第一次提交的ID(对象名),你就可以在github上查看它了…之类的……https://github.com/UserName/Repo/commit/6a5ace7b941120db5d2d50af6321770ddad4779e
需要使用git的git log——reverse命令。
这将以倒序(从最老的到最新的)返回指定回购的提交历史。
然后,在一些sed魔法的帮助下,您可以获得类似于第一次提交日期的信息(这是我自己一直需要的)。
git log --reverse | sed -n 3p
最后,您可能也想自动化这个操作(因为键入命令很无聊,或者根本不可能记住它),因此像这样的shell脚本可能会帮助您。