I want to maintain two different git repos. The repos should stay in the same root directory. How to achieve it?
What I'm want is: to manage two repositories that differ slightly. Can I have two completely different repositories in the same directory?
Yes, it is possible to have two git repositories in one directory.
In the command line, navigate to the directory where you would like to create a local clone of your new project. To create a repository for your project, use the gh repo create subcommand. When prompted, select Create a new repository on GitHub from scratch and enter the name of your new project.
Checking out more than one repo at a time in a single workspace is possible with Jenkins + Git Plugin (maybe only in more recent versions?). In section "Source-Code-Management", do not select "Git", but "Multiple SCMs" and add several git repositories.
You can achieve this by adding using one of these two options on the git command itself:
git --work-tree=where/my/code/is --git-dir=some/path/to/my/.git status
This would allow you to have 2 separate repos share the same working folder.
However you should be able to get what you need by using one repo with multiple branches and perhaps only push certain branches to multiple remotes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With