'How do I rename a container folder in git?

I have a folder in github that contains my application and I would like to rename it and I have been using the following codes to try to change the name but I am not sure how to use it

Commands use:

git mv \E:\Trabajo\LakiyEarth\lakiy-earth \E:\Trabajo\LakiyEarth\Lakiy
git mv lakiy-earth Lakiy

folder I want to rename



Solution 1:[1]

Use the git commands only inside the repository (folder). If you want to move or rename the folder itself, use a simple mv. Git doesn't know or care about its name.

Solution 2:[2]

Basic rename (or move):

git mv <old name> <new name>

…followed by commit and push would be the simplest way to rename a directory in a git repo.

Reference: https://www.patrick-wied.at/blog/rename-files-and-folders-with-git

Solution 3:[3]

What you want can't be achieved using git mv since it's already outside the scope of git for that project. What you want though is to rename your repo in github/gitlab. Then copy the new repo url.

Then inside your app directory, update the remote url to point to your new repo

git remote set-url origin new.git.url/here

Git doesn't really care if your app directory is the same as the repo name. So outside of your app directory, you can do a regular mv. Like so:

mv old-dirname new-dirname

Solution 4:[4]

Tried it to do it through git CLI commands, but since its the top-most folder to be changed, faced some trouble because to use git commands there must be .git folder which will be within the folder, not anywhere outside. Hence tried to use the repo's UI page to change the name of the folder. In my case of Gitlab, navigated to Settings -> General -> Advanced -> Change path to make the change.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jan Wilamowski
Solution 2 Divyesh_08
Solution 3
Solution 4 Poornima Devi