git rewrite history - Amending the message of Git commit made before a merge -


i committed test code before merging in remote branch. merge had lot of conflicts , took serious time put right. history looks this:

7ab562c merge remote branch ... whole load of commits brought across remote branch... f3e71c2 temporary testing commit 

the test code fine, want change commit message. i'd go right ahead git rebase -i f3e71c2^ (since none of has been pushed yet), i've been told colleague mess merge. don't want mess merge :)

is colleague correct? , if so, there can do, or need live history?

you can try git rebase --preserve-merges --interactive, with:

-p --preserve-merges 

instead of ignoring merges, try recreate them.

the bug section of man page includes:

the todo list presented --preserve-merges --interactive not represent topology of revision graph.
editing commits , rewording commit messages should work fine, attempts reorder commits tend produce counterintuitive results.


as jthill's comment describes (since -p better preserve merges if conflict resolutions recorder):

you can retroactively light rerere merge:

git config rerere.enabled true git checkout $merge^1 git merge $merge^2 git read-tree --reset -u $merge git commit -m- git checkout @{-1} 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -