user10913544
user10913544

Reputation: 13

Filter merge commit if merge commit is present or normal commit

I am just wondering if there is a way to show “merge commit” when present for a commit or normal commit when there is no merge commit.

NOTE: Commits are on same branch. Commit Message:

123329343erer Merge “Add global variable names.” 
1223243454d4 Relocate an blah 
1232ee53d343 Add global variable names 

Tree looks like:

* 123329343erer Merge “Add global variable names.”
|\ 1223243454d4 Relocate an blah
| | 1232ee53d343  Add global variable names
|/ .....

You see how the text of normal commit #3, and to merge #1 is similar. The only difference is "Merge:" in the commit message.

What I want to do is, when I do “git log”, I only want to see Commit Message:

123329343erer Merge “Add global variable names.” 
1223243454d4 Relocate a blah

So every time, there is a merge, I want to see merge commit, but also the normal commit if it didn’t have a merge.

Is this possible via git log?

Upvotes: 0

Views: 46

Answers (1)

bk2204
bk2204

Reputation: 76489

Git doesn't provide an option to do this. With git log, you can use --merges to view only merges, or --no-merges to view only non-merges, and you can use --topo-order if you want to see all of the commits on a branch separately from work on the main branch.

However, Git doesn't provide filtering of commits based on the messages (or other attributes) of different commits. Doing so would be complex to implement and likely perform badly in certain cases.

Upvotes: 1

Related Questions