Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git commit message showing file as 'copied' instead of 'modified'. What are the implications?

Tags:

git

strong textgit status shows file as modified, however when commiting it shows the file as been copied ie:

git status
modified: foo/bar/baz.xml

git commit
copied: bar/foo/baz.xml -> foo/bar/baz.xml

Why is it showing this file as copied if it was not. The two files were identical before the change.

like image 481
Justin Avatar asked Apr 20 '10 07:04

Justin


People also ask

What does copied mean in git?

if two files are the same (or very much the same) git recognizes them as copied.

How do I commit a modified file in git?

Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.

What is the correct commit syntax for all changes with a message?

git commit -a -m "new message" .... commits all changes.


1 Answers

git tracks content, not files. if two files are the same (or very much the same) git recognizes them as copied. there shouldn't be any implications from this

in your case both files were identical (100 %), so git has no possibility to know if the file was copied, or just accidentally happened to be the same.

don't worry, git only stores snapshots of the tree to the repository. you can control copy and rename detection for git log with parameters -C and -M, git will then try harder to find renames/copies

like image 176
knittl Avatar answered Sep 29 '22 01:09

knittl