Information Technology Reference
In-Depth Information
A_ new-name.txt
_D old-name.txt
5. Stage the removed file with the $ git rm old-name.txt command
and check the status with the $ git status -s command. The out-
put:
R_ old-name.txt -> new-name.txt
shows that git is smart enough to guess that the file was moved.
6. Create the revision with $ git commit -m "Committing a
file moved with mv" .
7. Check the status with the $ git status -s command. The output is
empty, therefore the repository is clean.
How It Works
The operation $ mv old-name.txt new-name.txt results in two changes de-
noted by:
_D old-name.txt
?? new-name.txt
The first change can be staged with $ git rm old-name.txt
To stage a second change you can use $ git add new-name.txt
When both changes are staged, git will guess that there is only one change—the file
was renamed:
R_ moved.txt -> sudir/moved.txt
This proves that in git the way you rename doesn't really matter.
4-9. Staging all files
Problem
Search WWH ::




Custom Search