Reputation: 111
I'm having trouble understanding how to git push
a sub-directory of a local repo directory to Github. For example, I have an established git connection with Gibhub that contains only the main directory and the .py script inside (project/script.py). I added a 'db' sub-directory with a single .json file inside (project/db/list.json). I want to push project/db/list.json to my Github to the already established directory (project) on the same branch.
Do you I need to git init
in the sub-directory or is it possible to simply push the actual sub-directory?
Upvotes: 1
Views: 3084
Reputation: 36
In git you have a specific workflow to follow.
To answer your question: After changing files in your project, you can add specific files to the staging area. Only these staged changes get commited and pushed in the following steps.
Like larsk pointed out, the Git book contains very helpful and further information about git.
Upvotes: 1
Reputation: 1329722
You always push the all repository, meaning all the commits you have done since your last push.
One of those commits might involve files from one folder, but that is not mandatory: you cam make a commit with changes from multiple folders.
In your case, as commented, add and commit your subfolder content. You can then push it.
Upvotes: 1