Kurisu

Kurisu

Using Git to share efficiently libraries between projects

You can go directly to the last paragraph of this post to read about my concern.


I was trying Git submodules then found the above post on Bitbucket, and it fits better my use case. The issue I had with git submodules is that my co-worker could not just pull a parent repository and just work on it without pulling explicitly the submodules also. With subtrees this complexity is gone. I can edit a shared library in any of the projects that are using it and push the commit to its remote repository. Then later in any other project that is using it I can make a pull request to have the library up-to-date. And my co-worker absolutely does not need to be aware of it for it to work.

But now I’m facing a situation that is a bit confusing, at least for me. I have a private repository for a library auth that is basically a set of helpers for authentication. I use it as a git subtree in multiple Elixir /Phoenix projects. So in my last project I have to deal multi-lingual content and I prefer that each application in the project handle the internationalization through its own Gettext backend. Then in my auth library I generate content in multiple languages for that project. But other projects that use this same library don’t necessary need those translations files.

So I’m wondering how to use .gitgnore files so that a parent git repository keep trace of a folder it generated inside a subtree repository, while the subtree repository should ignore that folder when pushing to its own remote repository. The folder in my case is the one that contains the Gettext translations. I can ignore the folder in the subtree repository, but is not it meaning that the main project repository will also follow that rule?

Most Liked

dimitarvp

dimitarvp

That’s exactly my point – now that I reread my post, it’s not clear, sorry. I meant put it on GitHub and don’t put on hex.pm indeed.

dimitarvp

dimitarvp

I’d rather not discuss Git submodules because I heard from several people that they are bad news. I haven’t used them so can’t comment.

In your case you might want to do two things:

  1. Self-host a private Hex repository.
  2. Put your common code there as a library.

I gathered from your post that you don’t want that common code to be public so this likely the solution you are looking for?

dimitarvp

dimitarvp

You are very wrongfully assuming that anyone even cares. :laughing:

Just do it, man. Make a common library, put it up publicly with a short note on what it does and how – don’t need to be detailed. Nobody guarantees any future readers they’ll find anything of use. The amount of abandoned projects out there is gigantic. Just don’t think about it and do it how it’s easiest on you. If that means a public repo, so be it.

Popular General Dev topics Top

AstonJ
Which apps do you think are killing it right now? Either from a technical perspective or ones that you like personally or feel have been...
New
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
New
AstonJ
Perhaps we can add some vids on sound differences, those I’ve seen so far are giving the plastic cases a nice stock sound (you could do s...
New
AstonJ
Do you think it’s worth worrying about? Do you think it’s going to be an even bigger issue in future? If so what can the teams of smaller...
New
DevotionGeo
The version of Java installed with Android Studio on my Mac is the following (when I run java -version) openjdk version "1.8.0_242-relea...
New
herminiotorres
Someone where use Doom Emacs right now? I like to starting this topic to discuss it and learn a little bit more, not just only the emacs ...
New
First poster: bot
To build a web application you need to make architecture decisions across a range of topics. The beauty of Ruby on Rails or Django is tha...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1017 16927 374
New
PragmaticBookshelf
A PragProg Hero’s Journey with Brian P. Hogan @bphogan Have you ever worried that your only legacy will be in the form of legacy...
New
Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
PragmaticBookshelf
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Author Spotlight: Tammy Coron @Paradox927 Gaming, and writing games in particular, is about passion, vision, experience, and immersio...
New

Latest in General Dev

View all threads ❯