[kwlug-disc] Subset of files in a second git repo

Doug Moen doug at moens.org
Tue Mar 31 14:15:08 EDT 2020


I am not a git expert, so the following may be incorrect.

However, my intuition is that this isn't possible exactly as stated.
The public.git repo contains no version information about private files.
Each git commit is a snapshot of the entire tree, and has a hash of all
the data in that snapshot. Since the public.git repo contains only a subset
of the files in main.git, all of the commit hashes will be different.
Therefore "pulling changes" from main.git into public.git won't be
possible in the way you envision it due to hashes not being the same.

Although I've never used it, I suspect that "git filter-branch" could be
used to make a copy of main.git from which all of the private files have
been removed. It is a very expensive operation, but it would serve the
purpose of making the revision history of all the public files available
to other people. It's not exactly what you asked for though.

Doug Moen.

On Tue, Mar 31, 2020, at 5:49 PM, Paul Nijjar via kwlug-disc wrote:
> 
> I have a git repo. Let's call it main.git . It has a bunch of files,
> most of which should stay private. 
> 
> I have a subset of those files that I would like to share with the
> public. Is it possible/easy to set up a second git repo public.git
> with the following properties: 
> 
> - Contains the files I would like to share and none of the other files
>   from main.git
> - "Tracks" development on main.git fairly easily (so if I make a
>   change to a public file and commit it, then I can easily pull that
>   change into the public repo). For this part, let's assume I can be
>   disciplined enough to make distinct commits for public files.
> - Has NO information in the git changesets about the private files.
> - Does not require me muddling with main.git (I do not want to make a
>   subproject that includes the public files and then have to worry
>   about incorporating that subproject into main.git)
> 
> The fallback is that I don't bother tracking the files, and just
> release a snapshot of files I manually copy out of main.git repository. 
> Being able to track the files in the public repo would be nice, but I
> am not willing to compromise my workflow on main.git (much) in order
> to accomplish this. 
> 
> - Paul
> 
> 
> 
> 
> -- 
> Events: https://feeds.off-topic.kwlug.org 
> Blog: http://pnijjar.freeshell.org
> 
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> https://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>




More information about the kwlug-disc mailing list