Thanks for the tips, I have another question, If I forget branch B
files' path, how chould I do without switch to B

Lei

On Mon, Dec 17, 2012 at 6:18 AM, Konstantin Khomoutov
<flatw...@users.sourceforge.net> wrote:
> On Mon, 17 Dec 2012 04:58:53 -0800
> lei yang <yanglei.f...@gmail.com> wrote:
>
>> now I'm in the branch A, I want to copy some file from branch B to A
>>
>> any help?
>
> Note that the already proposed
>
> git checkout $branch -- $filename
> git add $filename
>
> approach does not copy the file's history recorded in <branch> -- you
> only get the file's contents.
> In general, it's impossible to copy a file from one branch to another,
> preserving its history.
>
> Also note that if you want to save the file's contents into a
> differently named file, you should use another approach:
>
> git show $branch:$filename > $newfilename

-- 


Reply via email to