What about something like the following (on Linux)

git checkout -b newbranch
git ls-files | fgrep -v 'file.to.keep' | while read i;do git rm $i;done
# newbranch now only contains "file.to.keep"
git checkout B
git merge newbranch
git -d newbranch

I'm not too sure about this. I'm still too new at git to be sure of the 
"git ls-files" doing what I think.

On Tuesday, December 18, 2012 9:37:47 AM UTC-6, Dale Worley wrote:
> > From: Konstantin Khomoutov <flat...@users.sourceforge.net <javascript:>> 
> > 
> > In general, it's impossible to copy a file from one branch to another, 
> > preserving its history. 
> It must be *possible* to do that:  You could do a merge between the 
> head of A and the head of B, where all of the files of A are carried 
> into the merged version, and only the one file of B is carried into 
> the merged version.  The question is how to do that without needing 
> 1,000 commands. 
> Dale 


Reply via email to