Reputation: 107
I have a project, that is stored as a git-repo. The repo has several branches. Also I use OpenGrok (source browser) for the project. To be able to show all branches I cloned the project several times, after that did 'checkout' the required branch.
To update each workdir I do 'git fetch && git merge' for each workdir.
The Q: Is there a way to have one "main" clone, where need to do git fetch. After that each workdir will be updated from the "main" clone.
Upvotes: 0
Views: 504
Reputation: 315
The question does not state the reason for avoiding git fetch
in the branch clones so I will take it as 2 part question.
If the reason is say to save network bandwidth, you can change the origin
of the branch clones to the main Git repository.
Alternatively, if the question is to find means to efficiently synchronize the branch clones, I'd recommend to take a look at the Python tools supplied with OpenGrok. Specifically, the opengrok-mirror
tool provides a way to "synchronize" local repositories with their origins. See https://github.com/oracle/opengrok/wiki/Repository-synchronization for details.
Upvotes: 0
Reputation: 66283
Exactly that Problem ist addressed by the git worktree
commands: one repo but several working trees. Lookup the manual for that command!
Upvotes: 0