Re: [PATCH] transplant: move a series of commits to a different parent
- From
Alex Riesen <raa.lkml@gmail.com>
- Date
- Jun 24, 2007, 08:29 UTC
- Message-ID
- <20070624082906.GB2467@steel.home>
- In-Reply-To
- <11826268772950-git-send-email-prohaska@zib.de>
Steffen Prohaska, Sat, Jun 23, 2007 21:27:57 +0200:
Show 9 quoted lines
> +for commit in $(git-rev-list --reverse $from..$to) > +do > + echo "rewriting commit $commit..." > + git-diff-tree -r $commit | grep ^: | cut -b 9-15,57-97,100- | > + while read mode sha path > + do > + echo " $mode $sha $path" > + git-update-index --add --cacheinfo $mode $sha $path > + done
Why not just read-tree for every commit? It is not like you're modifying the repository in any way, just changing parenthood. That'd solve the problem with deletions. So it should be enough to read-tree the repo state for each and every source commit into the index (and you can just use a temporary index file for that, see GIT_INDEX_FILE). Than just commit the index.