On Fri, Mar 24, 2006 at 02:21:25AM -0800, Junio C Hamano wrote: > Metainformation fields are internally separated with SP and a > TAB comes before pathname; you can just say: > > sed -ne 's/^:[^ ]* D //p' That is much cleaner (I stupidly just converted the original regex verbatim). > a SP). You might also want to consider "xargs rm -f --", BTW. Oops, you're right. In particular, rm complains when there are no deletions. > However, I wonder why it does not do this instead: > > ... stash away the local changes > git-read-tree -m "$base" ;# reset the index to $base > > # switch to $branch -- removing gone files as well > git-read-tree -m -u "$base" "$branch" > > Then you can also lose diff-tree and checkout-index there. This doesn't deal very well with local changes. The second read-tree complains about a not uptodate entry during the merge. Since we've already stashed the local changes as a diff, we should be able to simply ignore them during the read-tree. Should the first read-tree actually be: git-read-tree --reset "$base" ? -Peff - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html