Git-Diff vs. Git-log? What's the difference?
I'm a little bit confused about Git. When I'm looking through the manual it appears the Diff is included in the Git-log manual. Also when I'm looking at tutorials and stuff, I find that Git log does much of the same 开发者_开发技巧stuff git-diff does. Is Git-Diff's functionality just a subset of Git-log?
Thanks!
git log
can use git diff
to display each change in the history. git log
is for displaying a set of revisions, potentially including the diff between each revision and its parent, while git diff
is used for displaying the difference between any two revisions in your repository.
git diff
can also be used to display diffs between the current working copy and the staging area (also known as the "index"), and diffs between the staging area and a revision in your repository, usually HEAD, while git log
will only ever show committed code.
So, they do have a bit of overlap, but neither one is a subset of the other. git log
uses git diff
for some forms of its display, and thus has the same options for setting how it calls git diff
.
精彩评论