Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does git confuse removal with rename/copy?

Tags:

git

The status report currently shows the following:


(source: gyazo.com)

However, when I do

git rm include/oogl/Buffer.hpp

the following happens:


(source: gyazo.com)

How do I just make it remove that file and leave the rest alone?

like image 265
Overv Avatar asked Jan 03 '11 18:01

Overv


Video Answer


1 Answers

Git is just removing the file. Renames are detected heuristically based on the amount of identical content in the two files, but this information is not stored in the commit. When you look up the commit later, Git will again determine heuristically if a rename happened based only on the new and removed files. So don't worry about it.

(See the Git FAQ, section Why does git not "track" renames?, and in particular this text: "Git has a rename command git mv, but that is just for convenience. The effect is indistinguishable from removing the file and adding another with different name and the same content.")

like image 175
cdhowie Avatar answered Oct 24 '22 22:10

cdhowie