我只想看到上次提交时提交的文件和git提交时看到的列表完全一样。不幸的是
git "last commit" log
在谷歌中我什么都得不到。和
git diff HEAD^..HEAD
当然,这并不是我所需要的,因为它也会释放出改变的本质。
我只想看到上次提交时提交的文件和git提交时看到的列表完全一样。不幸的是
git "last commit" log
在谷歌中我什么都得不到。和
git diff HEAD^..HEAD
当然,这并不是我所需要的,因为它也会释放出改变的本质。
当前回答
在执行多次提交或克隆/提取存储库之后,您可能希望看到已经进行了哪些提交。只需检查这些简单的解决方案,查看您的提交历史(从上次/最近的提交到第一次提交)。
对于最后一次提交,只需执行以下命令:git log -1。更多有趣的事情请看下面
To see the commit ID (SHA-1 checksum), Author name <mail ID>, Date along with time, and commit message - git log To see some more stats, such as the names of all the files changed during that commit and number of insertions/deletions. This comes in very handy while reviewing the code - git log --stat To see commit histories in some pretty formats :) (This is followed by some prebuild options)- If you have too many commits to review, this command will show them in a neat single line: git log --pretty=oneline To see short, medium, full, or even more details of your commit, use following, respectively - git log --pretty=short git log --pretty=medium git log --pretty=full git log --pretty=fuller You can even use your own output format using the format option - git log --pretty=format:"%an, %ae - %s" where %an - author name, %ae - author email, %s - subject of commit, etc.
这可以帮助您处理提交历史。欲了解更多信息,请点击这里。
其他回答
如果您正在讨论在执行了某个早期提交的git签出之后(并且在执行签出之前忘记写下HEAD的散列)找到最新和最大的提交,那么以上大多数方法都不会让您回到开始的地方。git log -[some #]只显示来自HEAD当前位置的日志,这并不一定是最后一次提交(项目的状态)。签出将断开HEAD并将其指向您签出的任何内容。
您可以查看整个git reflog,直到到达引用原始克隆的条目。顺便说一句,如果在克隆项目和执行签出之间进行了任何提交,这也不会起作用。否则,您可以希望本地机器上的所有提交都在服务器上,然后重新克隆整个项目。
希望这能有所帮助。
另一种只列出文件的方法是使用: git diff-tree——no-commit-id——name-only -r HEAD^. 或者可以使用任意两个提交id
查看上次提交的更改
git show HEAD
或者查看第二个最后提交的更改
git show HEAD~1
此外,只需将上面的“1”替换为所需的提交序列号。
在执行多次提交或克隆/提取存储库之后,您可能希望看到已经进行了哪些提交。只需检查这些简单的解决方案,查看您的提交历史(从上次/最近的提交到第一次提交)。
对于最后一次提交,只需执行以下命令:git log -1。更多有趣的事情请看下面
To see the commit ID (SHA-1 checksum), Author name <mail ID>, Date along with time, and commit message - git log To see some more stats, such as the names of all the files changed during that commit and number of insertions/deletions. This comes in very handy while reviewing the code - git log --stat To see commit histories in some pretty formats :) (This is followed by some prebuild options)- If you have too many commits to review, this command will show them in a neat single line: git log --pretty=oneline To see short, medium, full, or even more details of your commit, use following, respectively - git log --pretty=short git log --pretty=medium git log --pretty=full git log --pretty=fuller You can even use your own output format using the format option - git log --pretty=format:"%an, %ae - %s" where %an - author name, %ae - author email, %s - subject of commit, etc.
这可以帮助您处理提交历史。欲了解更多信息,请点击这里。
要查看最后一次提交:
git log -1
要查看最后2次提交:
git log -2
等等....