Subject: Re: possible 'git cp'/how does git detect copies

From: Johannes Sixt <[email-masked]>
Date: Fri, 27 Jun 2008 15:05:18 +0200

Mircea Bardac schrieb:
> I was looking today at duplicating a file but, I soon realized that
> there is no 'git cp' command (this was the "deductive approach to git
> commands", starting from git mv/rm/...). How does "git diff -C" detect
> copies (-C is used for this, according to the documentation)?
> 
> On a very simple test, I couldn't see this working. I just copied one
> file, added it, committed the change, ran "git diff -C HEAD^!". There is
> no place saying that it's contents is copied from some other file (both
> files are in the repository now).
> 
> "git blame -C new_copied_file" also doesn't show the commits for the
> original file.
> 
> This is all with 1.5.6.1.
> 
> I am probably missing something here... but I can't produce an example
> of copied contents that actually works. Any hint would be appreciated.

If you modify the original file in the same commit, then you should see
the copy. Otherwise, you can try git diff -C -C aka --find-copies-harder.

-- Hannes