Sunday, June 7, 2015

Delete folder with same names in CMD Windows and too long file names.

I continued playing with Android Source Code in BitBucket.org. But a small condition makes my confused for a while. Since the Android Source Code is a huge project and thus contains a number of submodules which are storing in other Github or BitBucket repositories. So when I uploaded these submodules to repository, only hash value of them are transmitted to repository.


I believed Git should provided some ways to solve this issue, but I am still looking for it. But one simple solution is to delete all .git folder in those submodules, so that Github can not recognize them as submodules. A question comes, how to delete all folders with same name in CMD Windows system. This command could solve this issue:

for /d /r . %d in (.git) do @if exist "%d" rd /s/q "%d"

Change to the root directory of Android source code, and then run this command. But do not forget to initialize the local Github repository again. Because this command will also remove .git folder at the root directory.

During adding to local working repository, some files have too long names which caused fatal exceptions to Github. The beneath command will tackle this issue:

git config core.longpaths true

Then everything worked fine!

No comments:

Post a Comment