In a Git repository, how to properly rename a directory? I think it should work to copy the directory to be renamed to a new directory with desired name, and delete the old directory, and git add
, git commit
and push
everything. But is this the best way?
相关问题
- How to access the camera from my Windows Phone 8 a
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
On https://github.com in their repository interface :
Go to settings --> Repository name --> input your new name in the area.
You can rename the directory using the file system. Then you can do
git rm <old directory>
andgit add <new directory>
(Help page). Then you can commit and push.Git will detect that the contents are the same and that it's just a rename operation, and it'll appear as a rename entry in the history. You can check that this is the case before the commit using
git status
From Web Application I think you can't, but you can rename all the folders in Git Client, it will move your files in the new renamed folders, than commit and push to remote repository.
I had a very similar issue: I had to rename different folders from uppercase to lowercase (like Abc -> abc), I've renamed all the folders with a dummy name (like 'abc___') and than committed to remote repository, after that I renamed all the folders to the original name with the lowercase (like abc) and it took them!
FYI I kept getting "FAILED \ Access denied" when using either Tortoise or the command line options to do the rename. It only work from the the command line option after I had closed the Explorer window.
I just renamed the directory and then added, committed and pushed to remote. It works fine
mv git add new_dir git commit -m "<>" git push
Basic rename (or move):
Case sensitive rename—eg. from
casesensitive
toCaseSensitive
—you must use a two step:(More about case sensitivity in Git…)
…followed by commit and push would be the simplest way to rename a directory in a git repo.