mateodelnorte / meta

tool for turning many repos into a meta repo. why choose many repos or a monolithic repo, when you can have both with a meta repo?
MIT License
2.03k stars 95 forks source link

Support Git Worktree and Bare Repos #320

Open bartdorsey opened 1 year ago

bartdorsey commented 1 year ago

🚀 Feature Proposal

Support adding projects as git worktrees and bare repositories.

Motivation

I like to keep my repositories checked out as git worktrees. Here's the common patterns I've seen people use

1) Checkout the main branch into <project_folder/main> and then use git worktree ../branch_name branch_name from inside main to check out other branch names 2) Checkout the repository as a bare repo, and checkout worktrees as subfolders of the bare repo. 3) Checkout the repository as a bare repo into a <project_dir>/.bare folder, and create worktrees inside the project folder.

We can have a discussion about which of these are the right approach, or if the meta tool should support all of these. But I'd be willing to adapt my workflow to which ever one meta adopts.

Example

git import --worktree --branches main, development <destFolder> [<childRepoUrl>]

Would result in a normal repo being cloned into <destFolder>/main (the first branch listed) and the remaining branches being added as git worktrees inside <destFolder>

git import --worktree --bare --branches main, development <destFolder> [<childRepoUrl>]

Would result in a bare repo being cloned into <destFolder> and the main and development branches being checked out as worktree folders inside <destFolder>

git import --worktree --bare --hidden --branches main, development <destFolder> [<childRepoUrl>]

Would result in a bare repo being checked out into <destFolder>/.bare and then the main and development branches being checked out as worktree folders inside <destFolder>