Home > Software design >  Git show multiple commits combined
Git show multiple commits combined

Time:12-01

How would I do something like git show commit1 commit2 but display the output as one combined commit, ie, review multiple commits as one?

CodePudding user response:

How do you want to combine commit messages? I don't think there is a reasonable way.

If you want to combine just diffs then use git diff instead of git show:

git diff commit1 commit2

See the docs.

CodePudding user response:

Ended up doing it like this:

git checkout -b tmp <commit0_sha>~
git cherry-pick <commit0_sha>
git cherry-pick --strategy=recursive -X theirs <commitn_sha>
git rebase -i `git merge-base tmp main`
git show

Would be amazing if there's a more terse way.

  •  Tags:  
  • git
  • Related