I have two files A (containing foo) and B (containing bar). I want to delete A and rename B to A so that I'm left with one file called A containing bar. And I want Git to track of the history of the bar text.
However Git treats it as if B has been deleted and A changed, thereby losing the content history.
By way of example:
$ git init
Initialized empty Git repository in /Users/tamlyn/git-test/.git/
$ echo foo > A.txt
$ echo bar > B.txt
$ git add .
$ git commit -m "Initial"
[master (root-commit) 043862d] Initial
 2 files changed, 2 insertions(+)
 create mode 100644 A.txt
 create mode 100644 B.txt
$ git mv B.txt C.txt
$ git commit -m "Moved"
[master 5a74a66] Moved
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename B.txt => C.txt (100%)
$ git rm A.txt
rm 'A.txt'
$ git mv C.txt A.txt
$ git commit -m "Move and delete"
[master 6b653a9] Move and delete
 2 files changed, 1 insertion(+), 2 deletions(-)
 delete mode 100644 C.txt
$ git log --stat -M
commit 6b653a91732ea0be92cc1e4e8d6b2af1a1133c70
Author: Tamlyn Rhodes <tamlyn@***.org>
Date:   Wed Dec 9 15:46:16 2015 +0000
    Move and delete
 A.txt | 2 +-
 C.txt | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
commit 5a74a663acd8563f8d2217de7369c89a591a7827
Author: Tamlyn Rhodes <tamlyn@***.org>
Date:   Wed Dec 9 15:45:43 2015 +0000
    Moved
 B.txt => C.txt | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
commit 043862d818562b23f4ef43c3fac36b7c384e0d89
Author: Tamlyn Rhodes <tamlyn@***.org>
Date:   Wed Dec 9 15:45:13 2015 +0000
    Initial
 A.txt | 1 +
 B.txt | 1 +
 2 files changed, 2 insertions(+)
