0

In the company we have a big repository BIG-REPO. I stores code base for all applications, services tools etc. Now my team is working on Web Application A. This application has dependencies on other parts of the BIG-REPO. Because in our team I want to introduce code review with pull requests, and also to have a stable branch for our application, I came up with this workflow:

  1. we have shared feature branch for our application, let's call this branch WebAppA branch
  2. each developer is working on some features for this application. When doing so, he/she creates a branch from WebAppA. So for instance we have WebAppAFeatureA and WebAppAFeatureB etc. Developers constantly push their branches to remote and issue PR to WebAppA. I do code review & merge changes. And also developers update their feature branches by rebasing to WebAppA. So far so good right?
  3. But because WebAppA has dependencies on other parts of the repository, that are developed by other teams, we sometimes need to incorporate their changes (which are already in master) into our WebAppA branch. And now the question I have: how to do it safely? Is it even possible?

Options I see are:

a) merging master into WebAppA. Drawbacks: I have merge commits. And I'm also not sure what will happen when I need to merge WebAppA back to master (for instance once a milestone is finished). Would it be ok/safe? It would look awkward in history: first I merge master into WebAppA , then I do otherwise.

b) rebasing WebAppA to master. From what I understand of how git works, this is a disaster as it will constantly change WebAppA history. And because this is shared branch then it will destroy everything (Golden Rule Of Rebase).

I don't have any other ideas. Could you advice?

2 Answers 2

2

Have you considered Git Submodules? https://git-scm.com/book/en/v2/Git-Tools-Submodules - This would allow you to nest either master in the WebAppA working directory (or vica versa) without causing the disaster of constantly changing the history.

One note on the git history - it does only track the specific diff (blob in git terminology) of the change - so if something in WebAppA changes, only that specific "blob" of data is committed, and wouldn't affect other files.

I'd highly recommend splitting up your codebase in BIG-REPO to contain smaller projects as their own repo, then use Submodules to "glue" them together.

Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

Repo is fixed - cannot be split into smaller project. Submodules - we cannot use it as well. Corporate rules....
0

Aside from splitting the repository and specifying the dependencies using build tools, language tools or git submodules, your solution (with merges) seems the sanest possible.

The two-way merges might look awkward, but you cannot avoid them in this situation.

Rebasing is no option, as it constantly rewrites history of WebAppA and its feature branches and that will be a pain for anyone who has to work with any piece of these branches.

1 Comment

Like I wrote in another comment - solutions to split depo and use dependency mgmt is beyond any discussion and is not an option :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.