Checking out a project's first commit with git

前提是你 提交于 2019-12-22 17:58:18

问题


Is there an easy way to find the SHA1 of the first commit in a project with a long history with git?


回答1:


Just off the top of my HEAD, this should get one of the 'first' commits of the current branch.

git rev-list --reverse HEAD | head -1

(If the branch contiains two unrelated branches which have been merged together, it's not guaranteed which root you will get but you could use --date-order to select the oldest.)




回答2:


git log --reverse | head -n1


来源:https://stackoverflow.com/questions/3270696/checking-out-a-projects-first-commit-with-git

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!