tags:

views:

33

answers:

1

I ran this:

 $ git mv README README.md

Then:

 $ git commit -m "renamed" README.md
 $ git push origin master

But over at github, the old README file still exists in the repository. Why ?

+2  A: 

Because you never actually committed the deletion portion of the move.

http://www.kernel.org/pub/software/scm/git/docs/git-commit.html

The content to be added can be specified in several ways:

...

3) by listing files as arguments to the commit command, in which case the commit will ignore changes staged in the index, and instead record the current content of the listed files (which must already be known to git);

Note the crucial bit here: will ignore changes staged in the index. git mv stages both the removal of the old file and the creation of the new one, but does not commit them. When you call git commit README.md, it commits the new-name version of the file, but ignores the staged deletion of the old file.

Try this sequence instead:

$ git mv README README.md
$ git commit -m "renamed"
$ git push origin master
Amber
Good spot on the unusual form of commit.
Charles Bailey