Git mv How to Renaming/Moving Directory

October 28th, 2011 by Regaz

Here is the Commands Sequence for Renaming or Moving a Directory inside a Git Repository
First you Rename/Move without git:

mv yourDir/yourNewDir/

Second you Remove your Directory from Repo:

git rm -r yourDir

Third you add the Freshly Renamed/Moved Directory:

git add .

Then after a:

git status

You will see listed under “Changes to be commited” the complete Directory Renaming/Moving like:

# renamed: yourDir/... -> yourNewDir/...

Now to Permanently Fix your Renaming/Moving just execute a Commit:

git commit -m "Renaming yourDir yourNewDir"
(Visited 1 times, 1 visits today)

Tags: , ,