-1

I need to find the changes made by each commit.

So I used git log to find the list of all commits.

Then I use git diff-tree current-commit previous-commit [some other options] to find the changes.

The problem is the repo has more than 3000 commits, so doing 3000 git diff-tree is quite time-consuming ?

Is it possible to do a single git diff-tree (fed by the list of all commits) to get all the changes.

Philippe
  • 20,025
  • 2
  • 23
  • 32
  • 1
    Just `git diff`? – KamilCuk Jun 23 '22 at 00:02
  • @KamilCuk You mean a single `git diff` ? I did take a look at it already but failed to find the proper options/arguments – Philippe Jun 23 '22 at 00:10
  • 1
    Why are you using git diff-tree in the first place? What's the goal? What does "find the changes" mean? Why wouldn't you just say `git log --patch` if you want to see all the changes between all successive commits? – matt Jun 23 '22 at 02:48

2 Answers2

3
git log  -m --raw --no-abbrev --oneline --all

or if you want to get cute see git diff-tree's --stdin option.

jthill
  • 55,082
  • 5
  • 77
  • 137
3

git log can print the diff of each listed commit (the diff is hidden by default, turn it on with the -p|--patch option), and can take all the options accepted by git diff (--name-only, --name-status, options for merge commits, ...)


@jthill's answer gives a set of options that basically outputs the same thing as git diff-tree for each commit.

You would have to describe in more details what information you are interested in if you want someone to provide you with a more suitable set of options.

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • 1
    Note that `git log -p` by default shows *nothing* for merge commits. Use `-m` to split merges, or since Git 2.31, one of the `--diff-merges` settings, to change this. – torek Jun 23 '22 at 10:36
  • @torek I'll try -m and --diff-merges. – Philippe Jun 23 '22 at 11:58