Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 如何查看回购协议的先前提交?_Git - Fatal编程技术网

Git 如何查看回购协议的先前提交?

Git 如何查看回购协议的先前提交?,git,Git,我正在阅读一个提交次数超过1000次的开源库。我想在不同的提交时读取存储库。我不想在本地或远程重置任何内容。这需要哪些命令?如果您只想查看以前的提交,那么git log--oneline可能就是您所需要的全部 如果然后要恢复到特定的提交,请说a,然后 git checkout -f A -- . 我想在不同的提交时读取存储库 做到这一点最简单、最干净的方法是在IDE中使用一个diff工具(例如IntelliJ、Eclipse)或Git工具(例如SourceTree)。这将允许您比较分支中的任意

我正在阅读一个提交次数超过1000次的开源库。我想在不同的提交时读取存储库。我不想在本地或远程重置任何内容。这需要哪些命令?

如果您只想查看以前的提交,那么
git log--oneline
可能就是您所需要的全部

如果然后要恢复到特定的提交,请说a,然后

git checkout -f A -- .
我想在不同的提交时读取存储库

做到这一点最简单、最干净的方法是在IDE中使用一个diff工具(例如IntelliJ、Eclipse)或Git工具(例如SourceTree)。这将允许您比较分支中的任意两个提交

如果您确实需要在以前的提交中进行一些认真的检查,那么我建议您通过以下方式在以前的提交中签出分支:

git checkout <sha1>
$git log#查看要执行的提交和复制哈希
$git checkout#签出到该提交
$git checkout#返回分支机构负责人

然后如何将代码切换到该提交?我希望本地回购与提交时完全相同,然后能够一次又一次地切换。然后您需要还原到特定的提交-请参阅editrevert是一个糟糕的词语选择,因为这在git中意味着其他内容。
git checkout yourBranch
$ git log                     # see the commits and copy hash you want to go
$ git checkout <commit-hash>  # checkout to that commit

$ git checkout <branch-name>  # back to the HEAD of branch