Merges produced by git pull from upstream repository results
in history with "wrong" first-parent ancestry. Tool fixmerge.sh
fixes such a commit. It also modifies the commit message to reflect
what was really merged where.
--- /dev/null
+#!/bin/sh
+
+# Changes the order of parents and commitlog in the merge produced by git pull. It produces
+# the nicer history with git log --first-parent
+
+git filter-branch -f --parent-filter "tee ~/P.OUT | awk '{if(NF==4) print \$1,\$4,\$3,\$2;}'| tee -a ~/P.OUT" \
+ --msg-filter "sed 's/\(Merge branch .*\) of/\1 into/'" HEAD^!