Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git log --full-diff, what does it do?

Tags:

git

The git-log documentation explains the parameter --full-diff.

In detail:

Without this flag, git log -p ... shows commits that touch the specified paths, and diffs about the same specified paths. With this, the full diff is shown for commits that touch the specified paths; this means that "…​" limits only commits, and doesn’t limit diff for those commits.

Note that this affects all diff-based output types, e.g. those produced by --stat, etc.

I've no idea what it tries to explain, can someone give me an example maybe.

like image 442
Moerwald Avatar asked Jun 23 '19 14:06

Moerwald


People also ask

What does git diff do?

Comparing changes with git diff Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.

What does git log tell you?

The git log command shows a list of all the commits made to a repository. You can see the hash of each Git commit , the message associated with each commit, and more metadata. This command is useful for displaying the history of a repository.

Does git log show all branches?

Graph all git branchesDevelopers can see all branches in the graph with the –all switch. Also, in most situations, the –decorate switch will provide all the supplemental information in a formatted and nicely color-coded way.

What does ++ mean in git diff?

When viewing a combined diff, if the two files you're comparing have a line that's different from what they were merged into, you will see the ++ to represent: one line that was added does not appear in either file1 or file2.


1 Answers

Sure. Let's say you have a commit C that makes changes to file A and file B.

Regular git log -p -- A will show all commits that touch file A, and for those commits, it'll show the diffs to A. With --full-diff, it'll show the same commits, but for each commit it'll show the diff of all files changed in that commit. In this case, commit C's diff will show diffs for files A and B.

like image 151
GaryO Avatar answered Oct 04 '22 10:10

GaryO