From dc99d75e8ee32b650f5ac642b964cfaa303d18d8 Mon Sep 17 00:00:00 2001 From: Kacper Kornet Date: Thu, 11 Apr 2013 18:00:47 +0100 Subject: [PATCH] Add tool to reverse order parents in commit produced by pull 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. --- fixmerge.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 fixmerge.sh diff --git a/fixmerge.sh b/fixmerge.sh new file mode 100755 index 0000000..90ef7a2 --- /dev/null +++ b/fixmerge.sh @@ -0,0 +1,7 @@ +#!/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^! -- 2.44.0