I accidentally created commits by "unknown" in my repository, and decided to try running a command from here:
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "unknown" ];
then
GIT_COMMITTER_NAME="..";
GIT_AUTHOR_NAME="..";
GIT_COMMITTER_EMAIL="...";
GIT_AUTHOR_EMAIL="...";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
At first I thought everything was fine, until I noticed in gitk that every commit prior to running this was duplicated, not simply edited as I originally thought.
Is it possible to clean this up?
EDIT: OK, gitk is showing both the old commits (the ones with the "unknown" commiters mixed in) and the new commits (the rewritten ones), split up at a certain point around halfway. Think a bunch of commits, then duplicated (and with the edits), and stacked on top of the original ones. What I want to do is if possible, is remove the original ones.
...--a--b--c--(*)--a'--b'--c'--d--e
, where(*)
is the commit on which you ran the bad command,[abc]'
are erroneously duplicated commits you want to delete, and[de]
are commits you want to keep? – Captivate'
ones as they have the author fields fixed. – Justino