Tsallaka zuwa abun ciki
Justice Tech School

Renaming and Moving

git mv renames and stages. Git sees renames from content.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
mkdir src
git mv a.txt src/main.txt
git status -s
git commit -qm 'Move file'
git log --format=%s -n 1

Result

R  a.txt -> src/main.txt
Move file

Exercise

Rename.

git  old new

Quiz Test

What does git mv do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.