how to get git diff to only show commit messages

Use:

git log --oneline -n 10

It will print out the last n (10) commits on single lines. Just the commit messages.

You can also combine it with other log parameters, like:

git log --oneline --graph --decorate -n 10

You could try git log, thus,

git log commitA...commitB

The triple dot notation '...' gives you just the commit messages for all the commits that are reachable from commitA or commitB, but not from both - i.e., the diff between commitA and commitB.

You can easily strip down to just the commit message with something like:

git log --pretty=%B commitA...commitB

Some examples

# Show a log of all commits in either the development branch or master branch since they diverged.
git log --pretty=%B development...master
# Ahow a log of all commits made to either commit b8c9577  or commit 92b15da, but not to both.
git log --pretty=%B b8c9577...92b15da
# Show a log for all commits unique to either the local branch master or local version of the origin's master branch.
git co master
git log --pretty=%B master...origin/master
# Show a log for all commits unique to either the local HEAD or local version of the origin's master branch.
git co master
# Hack, hack
git log --pretty=%B HEAD...origin/master

Tags:

Git