Rename the files and folder in GIT

Rename the files and folder in GIT:

1. Some times we may want to rename the file or folder name in your project.

2. Here Will see what command we have to use for rename the file. 

Syntax: git mv <OLD FILE NAME> <NEW FILE NAME>

Example: git mv <first.html> <first_update.html>

3. Here my first.html is my actual file name which is already available under GIT.

When i execute the above command then the file name changed into first_update.html
4. After run the above command check the status. It will show as like below to commit the

changes to GIT.

git status

On branch first_branch

Changes to be committed:  (use “git reset HEAD <file>…” to unstage)
renamed:    first.html -> first_update.html
Now our file name change is done but we need to commit & push changes to GIT.

git commit -m "file name changed from first.html to first_update.html"

[first_branch 121112] file name changed from first.html to first_update.html 1 file changed, 0

insertions(+), 0 deletions(-) rename first.html => first_update.html (100%)

 

Be Patient, Drive With Care