A
A
Albert Kazan2019-02-14 00:53:17
git
Albert Kazan, 2019-02-14 00:53:17

How to update code in two repositories?

There are two projects, they use the same backend, only something for the front changes. By changing the backend in one, how is it possible to pour these updates into another project?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Deyashkin, 2019-02-14
@Farrien

In this case, you should move the backend to a separate repository and include it as a dependency. I don’t know of normal options for solving this through git, and I very much doubt that they exist for the simple reason that git is not designed to solve such problems. In fact, you get three products interconnected by different links. Two versions of the frontend (two products) are linked by a common "base" (code), that is, this is similar to "inheritance" in OOP from a common base class. And they "depend" on the backend. Moreover, they may depend on different versions of it (most likely they will, sooner or later). That is, it's more like "composition" in OOP terms. And so git - it is not urged to solve a problem of dependences of one project from another. To do this, you need to use the dependency manager. Don't know,
If you really want to stay within the framework of a monolithic repository, you can come up with options - but they require serious study, writing auxiliary scripts and will not be convenient.
For example. We have a repository (or a branch / several branches) for each project. When changing the backend code in one of the projects, we merge it with the code of another project, while ignoring all non-backend changes. The practical implementation of this depends on the structure of the code and your workflow in general. But the history of the project will not be pretty - all these merges that also ignore frontend changes ... It will work, but ... it's terrible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question