Initial push to GitHub Missing Sub Directory

女生的网名这么多〃 提交于 2019-12-23 04:03:12

问题


I made an initial push to GitHub from our codebase but one of the two websites sub directory didn't get pushed for some reason.

We had .git files in both sub directories but removed them prior to making this new combined repository.

We've tried adding a single file to the sub directory but SourceTree isn't seeing picking up the changes.

How would you add those subfolders?


回答1:


We had .git files in both sub directories but removed them prior to making this new combined repository.

It is not enough: you need to remove (untrack) the gitlink (folder name of the two subdirectories, viewed as a special entry in the index of the parent repo)

 git rm --cached subfolder1
 git rm --cached subfolder2

 git commit -m "remove gitlinks"

Then you can add and commit (provided the nested .git/ folders are indeed gone)

git add .
git commit -m "add two subfolders"
git push 


来源:https://stackoverflow.com/questions/42654461/initial-push-to-github-missing-sub-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!