The documentation for git status
[1] implies that it should be able to detect renames and copies (with the C
state) or no matter what git diff -C
should do it, but neither appear to work:
mkdir test
cd test/
git init
echo 'Hello World!' > hello.txt
echo 'Goodbye World!' > goodbye.txt
git add -A
git commit -m "Initial commit"
cp hello.txt copied.txt
mv goodbye.txt moved.txt
git add -A
$ git status --short
A copied.txt <------------ NO COPY DETECTED
R goodbye.txt -> moved.txt
$ git diff -M -C --summary --cached
create mode 100644 copied.txt <------------ NO COPY DETECTED
rename goodbye.txt => moved.txt (100%)
$ git commit -m Test
$ git diff -M -C --summary HEAD~
create mode 100644 copied.txt <------------ NO COPY DETECTED
rename goodbye.txt => moved.txt (100%)
Side related question: is it possible to have git status
or git diff
detect copies and renames in the workdir prior to adding the changes to the index?