I have over 6000 image files that I need to push to a github repository (into 6 individual folders). However I can only upload 100 folders at a time, and I'd rather not just drag and drop for an hour. Is there a way to use git bash to deposit 1000 files at a time into the github folders? I've already cloned the repository into a local machine, so I just need to find a way to add over a 1000 files at once into the folder directory, and then commit and push. Any help would be greatly appreciated!
CodePudding user response:
You can add only the first n files, as illustrated here, using git ls-files
(listing untracked, not ignored files):
git ls-files --others --exclude-standard | head -n 1000 | xargs -0 git add
You can see more at "How do I run a command on all files from git ls-files?"
CodePudding user response:
As written in your question, you already cloned the repository on your machine. Let's assume the repo is cloned into C:/path/to/repo
. This means that the content of this folder is a representation of the content of your repository.
To add the files, you first need to copy them into this folder or a subfolder thereof. For example, you can place them in C:/path/to/repo/folder1
, C:/path/to/repo/folder2
, ...
Afterwards, add them to the index with git-add, e.g. with git add folder1
, git add folder2
, ...
Then you can commit the changes (in this case all the new files that are were added to the index) with git-commit, e.g. git commit -m "Add 6000 images"
.
Finally, you can push with git-push, e.g. git push
.