Diamond <diam...@hi-net.ru> wrote:
>
> There's no git cp command.
> git mv is just git rm + git add.

I think there is a misunderstanding about how git works.

If you are used to e.g. svn (I suppose with CVS it is similar)
then it makes an important difference whether you use
"svn cp A B" or "/bin/cp A B", because svn is file-centric:
The latter loses history and duplicates data in the repository,
while the former de-duplicates.

git, OTOH is "blob"-centric: It cares only about content of the
file, not where this content comes from; the information that
you copy A to B is not stored, and it does not need to be stored:
De-duplication happens automatically.

In other words, there is no way for git to "see" that B originally
was a copy of A, and normally there is also no such need.
If you think that this information is important enough to be
stored in the history, you have to make a commit where B is
completely identical to A before you make further
modifications for B (identical files have the same checksum and
thus are immediately identified).
If you make no such commit, git can guess only by similarities
of the content that B originally was as a copy of A; this,
of course, needs slightly longer than omitting such comparisons.

For this reason, there is absolutely no reason to use git for
file operations like cp or mv (as long as you add/remove the
corresponding files from the index before you commit, of course).


Reply via email to