File renamed when git rm and git add done on different files -
i did git rm file1.c
after git status
shows
on branch master branch ahead of 'origin/master' 2 commits. (use "git push" publish local commits) changes committed: (use "git reset head <file>..." unstage) deleted: file1.c untracked files: (use "git add <file>..." include in committed) dir/file2.c dir/file3.c
all , far. if git add dir/file2.c
get
on branch master branch ahead of 'origin/master' 2 commits. (use "git push" publish local commits) changes committed: (use "git reset head <file>..." unstage) renamed: file1.c -> dir/file2.c untracked files: (use "git add <file>..." include in committed) dir/file3.c
is bug or doing wrong? expect new file listed new file. file1.c , file2.c in no way have similar content [edit] besides short copyright notice [\edit].
this not bug, feature.
when remove file, , add file of code same, operation equivalent renaming file.
hence, git displays as
renamed: file1.c -> dir/file2.c
check this link on git-scm more details. also, can check git fails detect renaming , how git detect similar files, rename detection.
Comments
Post a Comment