September 2009
Beginner
942 pages
85h 34m
English
mv
git mvoldfile newfilegit mvoldfiles...newdir
Rename oldfile to newfile or move a series of oldfiles into the directory newdir, which must already exist. git mv updates both the work tree and the index.
There is no need for a git cp (copy) command. Just copy the file using Unix cp and git add. Git is still able to track the history of files moved and copied in this way.
| -f (overwrite even if newfile exists) |
| -n, --dry-run |
To rename file1.c to file1b.c:
$ git mv file1.c file1b.cTo move file1.c and file2.c into the mylib directory:
$ git mv file1.c file2.c mylib/