D
D
developer0072016-12-06 09:55:02
git
developer007, 2016-12-06 09:55:02

How to store GIT branches in different folders?

There is a big project with a bunch of all sorts of components - a web system
(everything is in var/html/site1 ...)
it's just a master branch
1) there is a need to create a branch - new_site2 and that the content (all scripts, etc.) be in another folder var/html/site2
why as a separate branch and not a repository?
during the development of new_site2, some components (common and for master) have errors. the files of these components need to be merged into the master branch, which is supposedly located in var/html/site1 ...
Is it possible to do this?
Maybe I don’t understand something and it’s all done differently

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lynn "Coffee Man", 2016-12-06
@developer007

Git since version 2.5 has git worktree https://git-scm.com/docs/git-worktree

F
Fat Lorry, 2016-12-06
@Free_ze

To store different branches in different folders, you can clone the same repository into two different folders, in each of the resulting local repositories, switch to the desired branch. But there is no point in this, because it is quite simple and painless to switch using checkoutand stash.
But usually for such common fixes for branches that do not plan to merge, they start a separate branch from the common parent (if possible), commit the fixes to it and merge into the branches where these changes are needed.
If this is not possible (they branched out from the parent too long ago and it will be difficult to merge), then you can commit to one of the branches, but not merge all of it directly into another, but transfer only new commits using the command cherry pick.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question