Gökhan Çoban
Gökhan Çoban

Reputation: 610

How can I hide some files from public but also version them in Github repository

I have a public repository on Github. In this repository I am sharing single file java applications structured as follows:

Root
  Folder1
    JavaApp1.java
    JavaApp2.java
  Folder2
    JavaApp3.java

In the other hand I am compiling these java applications within IntellijIdea. The problem is, I don't want to share *.iml files etc. in my public repository because I want to keep the repository as simple as possible.

In the other hand I want to store *.iml files etc. in Github for my own need. What can I achieve this requirement with Git?

Upvotes: 3

Views: 3540

Answers (1)

VonC
VonC

Reputation: 1323125

You would need two repos:

  • one private for Root, including your iml files
  • one public for your Java sources, referenced by the first one as a submodule.

That way, you only clone you first private repo (and get your Root folder), and that will clone the submodule as well (in a "src" subfolder for instance)

cd /my/private/repo
git submodule add  -- /url/public/repo src

Upvotes: 2

Related Questions