dcn
dcn

Reputation: 4469

Branch invariant directory in git repository

Is there a way to make a directory in a git repository always the same in all branches?

The scenario which I have in mind is the following: consider you are working on a project/thesis where you are experimenting a lot (i.e. creating a branch, try something out/do measurements/statistics, typically not merge it back to master) plus you write a documentation/thesis where you want to have content/results from all (incl. experimental) branches. Switching back and forth the branch of course works for the experiments itself, but for your doc/thesis you really only want a single current version at all times.

An alternative would be to put your doc into a separate branch (like some projects do), but I personally find it annoying to always switch whenever you want to add something to your doc/thesis.

Also I could have two repositories, but that somehow goes against my intuition of a repository as the thing that contains all stuff about project XY...

Upvotes: 4

Views: 56

Answers (1)

Paul Annesley
Paul Annesley

Reputation: 3397

Take a look into the simple but clunky git submodule or the slicker but more complicated git subtree.

They let you embed a separate repository into your repository, which might serve your purpose.

Upvotes: 2

Related Questions