Reputation: 1
I have created a Java project with IntelliJ. The project structure looks like:
rootfolder\projectname\src\*.java
And I would like to upload my Java classes to GitHub, but without src
folder, like this:
rootfolder\projectname\*.java
Upvotes: 0
Views: 127
Reputation: 146
In your .gitignore (at the root of your project)
You can add :
project/a/*/
Note that the last slash means it's a directory and is therefore important to keep
Upvotes: 0
Reputation: 60527
project/a/src/*
!project/a/src/files
Ignoring a directory is a summary execution, git's auto-add never even scans an ignored directory's contents (which is kind of the point of ignoring a directory, build systems can spew an astonishing amount of junk), so to ignore everything in a directory except a few things, you ignore everything in that directory except those few things, you don't ignore the entire directory.
Upvotes: 1