问题
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