Git Branches - How to have a clean release branch without submodules

I have a git repo for my project which is loosely based on GitFlow. I have a master branch, development branch (where all the work gets done) and a release branch.

My repo depends on a few submodules, which I want to continue to track as these submodules get updated, however, I don't want my release branch to contain the submodules in their entirety (tests, docs, et al) I just want my release branch to contain the "product" of the submodule.

My development branch contains everything, as does master. Development periodically gets merged into master. My release branch is currently master, but I just want a clean release branch that isn't stuff full of my development files.

I have attached a rough sketch in case it helps.

How do I do this?

Answers


Normally this type of cleanup is the job of your release scripts, i.e. a process that cuts release archives (or whatever else you release) based on your working tree. I think most people don't see the need to clean it up right in the repository.

Of course, that doesn't mean you can't do it if you want to. You can simply 'git rm' all the files/paths (including submodules) you don't want to keep while creating the merge (git merge -n allows you to change the merge contents even if there were no conflicts). This is not the way merges are meant to be used, but at least it won't make the universe implode. as long as you never merge back the release branch to other branches, or start new development branches based on it.

Note that this way you'll probably get merge conflicts in the affected paths each time you merge to the release branch, but that can't be helped. Just repeat the same thing each time.

Oh, and just to cover all bases: you can't remove only part of a submodule – it's all or nothing.

PS. in case you aren't already, use --no-ff to merge to the release branch. That way, these branch-specific changes will be "hidden" in the merge commit and won't litter your history with "get rid of these files" commits.


Need Your Help

How to insert specific symbols in qt widgets

qt unicode character-encoding qt5

I want to make buttons with specific math symbols, like square root, delta, sigma, pi, etc. How to do this? I'm using Qt 5 and unicode. Thanks

In which order is model binding and validation done in ASP.NET MVC 2?

asp.net-mvc validation ckeditor automapper

I am using ASP.NET MVC 2, and am using a view-model per view approach. I am also using Automapper to map properties from my domain-model to the view-model.