I've already put codes in my repositories in Github once, but now I'm messing around with Netbeans using HTML5, and I have other folders like CSS, Javascript, and the like. Is it possible, when uploading the code, to upload these folders too?
I've already put codes in my repositories in Github once, but now I'm messing around with Netbeans using HTML5, and I have other folders like CSS, Javascript, and the like. Is it possible, when uploading the code, to upload these folders too?
Git does not allow empty directories. But when I need to upload a folder I create a hidden file inside the directory to upload this directory. For example:
touch pasta/.teste
Apply git add pasta/
to add a specific folder or git add .
to upload all folders and changes.
As long as these folders are not listed in the .gitignore file and are not empty they will be sent to the repository.
Do not forget to add the folders before commitar
$ git add pasta/
If you want to send a folder that does not have commit files, you'll need to use some alternate method for this. One approach I use a lot is to create an empty file with the name .getkeep
. That way I can tell you what the file's utility looks like just by looking at your name.
You can create this file using the command touch
touch pasta/.gitkeep
I like to do it in a way that I learned to do in projects on Laravel. When I need to have the folder in production, but I do not need the files inside those folders to be monitored, I create a .gitignore
within the folder in question and I put the following excerpt:
And I put PastaQueEuQuero/.gitignore
:
*
!.gitignore
In this case only the .gitgnore
file along with the folder is sent to the repository when doing git add PastaQueEuQuero
.