Removing and Renaming Files
git rm deletes a file and stages the deletion. git mv renames a file and stages it. Git detects renames by content.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git mv a.txt b.txt
git status --short
git commit -qm 'Rename a to b'
git rm -q b.txt
git status --shortResult
R a.txt -> b.txt D b.txt
Exercise
Rename a tracked file.
git a.txt b.txt
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.