Skip to contentSkip to conversation

git log and --first-parent

DISCUSSION Robin Rosenberg 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

I'm puzzled over the behavior of --first-parent. The documentations seems to imply that only the first parent is followed, but when a filter is applied it seems (just guessing) that the "first" parent is selected *after* filtering, a behaviour that I feel does not match the documentation.

Should the first-parent filter be applied first.

Example:

	git log --first-parent --pretty=format: --name-only v1.5.2|grep ^var.c|wc -l

counts four commits where var.c was changed, while

	git log --first-parent --pretty=format: --name-only v1.5.2 -- var.c |wc -l

gives me 23.

-- robin

#1 lore raw

tisdag 24 juli 2007 skrev Robin Rosenberg:

Quoted 12 lines

I'm puzzled over the behavior of --first-parent. The documentations seems to imply that only the first parent is followed, but when a filter is applied it seems (just guessing) that the "first" parent is selected *after* filtering, a behaviour that I feel does not match the documentation.

Should the first-parent filter be applied first.

Example:

	git log --first-parent --pretty=format: --name-only v1.5.2|grep ^var.c|wc -l
Quoted 7 lines

counts four commits where var.c was changed, while

	git log --first-parent --pretty=format: --name-only v1.5.2 -- var.c |wc -l

gives me 23.

-- robin

Now, I also realize fast-forwards means --first-parent may not be as useful as I first hoped.

-- robin