feat: add worktree / workspaces implementation
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit was merged in pull request #91.
This commit is contained in:
34
examples/config/git-worktrees.toml
Normal file
34
examples/config/git-worktrees.toml
Normal file
@@ -0,0 +1,34 @@
|
||||
# Example: git with worktree support
|
||||
#
|
||||
# Uses bare repositories for worktrees. Directory layout:
|
||||
#
|
||||
# ~/git/github.com/owner/repo/
|
||||
# ├── .bare/ # bare clone
|
||||
# ├── main/ # worktree
|
||||
# └── feature-x/ # worktree
|
||||
#
|
||||
# Usage:
|
||||
# gitnow worktree # pick repo, then pick branch
|
||||
# gitnow worktree myrepo -b main
|
||||
|
||||
[settings]
|
||||
# Normal clone (used by `gitnow` without worktree subcommand)
|
||||
# clone_command = "git clone {{ ssh_url }} {{ path }}"
|
||||
|
||||
[settings.worktree]
|
||||
# All of these are the defaults — shown here for reference.
|
||||
# You only need [settings.worktree] if you want to override them.
|
||||
|
||||
# Bare clone for worktree repos
|
||||
clone_command = "git clone --bare {{ ssh_url }} {{ bare_path }}"
|
||||
|
||||
# Create a worktree from the bare repo
|
||||
add_command = "git -C {{ bare_path }} worktree add {{ worktree_path }} {{ branch }}"
|
||||
|
||||
# List branches in the bare repo
|
||||
list_branches_command = "git -C {{ bare_path }} branch --format=%(refname:short)"
|
||||
|
||||
[[providers.github]]
|
||||
current_user = "your-user"
|
||||
access_token = { env = "GITHUB_ACCESS_TOKEN" }
|
||||
organisations = ["your-org"]
|
||||
42
examples/config/jj-worktrees.toml
Normal file
42
examples/config/jj-worktrees.toml
Normal file
@@ -0,0 +1,42 @@
|
||||
# Example: jj (Jujutsu) with workspace support
|
||||
#
|
||||
# Uses jj for both normal clones and worktrees/workspaces.
|
||||
#
|
||||
# Normal clone (`gitnow`):
|
||||
# ~/git/github.com/owner/repo/ # jj git clone
|
||||
#
|
||||
# Worktree/workspace (`gitnow worktree`):
|
||||
# ~/git/github.com/owner/repo/
|
||||
# ├── .bare/ # jj git clone (used as the main repo)
|
||||
# ├── main/ # jj workspace
|
||||
# └── feature-x/ # jj workspace
|
||||
#
|
||||
# Usage:
|
||||
# gitnow # clone with jj, enter repo
|
||||
# gitnow worktree # pick repo, then pick branch/workspace
|
||||
# gitnow worktree myrepo -b main
|
||||
|
||||
[settings]
|
||||
# Use jj for normal clones
|
||||
clone_command = "jj git clone {{ ssh_url }} {{ path }}"
|
||||
|
||||
# Runs after a project is fetched for the first time
|
||||
post_clone_command = "jj git fetch --all-remotes"
|
||||
|
||||
# Runs when jumping to an already-cloned project
|
||||
post_update_command = "jj git fetch --all-remotes"
|
||||
|
||||
[settings.worktree]
|
||||
# Clone the repo for worktree use
|
||||
clone_command = "jj git clone {{ ssh_url }} {{ bare_path }}"
|
||||
|
||||
# Create a new jj workspace for the selected branch
|
||||
add_command = "jj -R {{ bare_path }} workspace add --name {{ branch }} {{ worktree_path }}"
|
||||
|
||||
# List bookmarks from the jj repo (one name per line)
|
||||
list_branches_command = "jj -R {{ bare_path }} bookmark list -T 'name ++ \"\\n\"'"
|
||||
|
||||
[[providers.github]]
|
||||
current_user = "your-user"
|
||||
access_token = { env = "GITHUB_ACCESS_TOKEN" }
|
||||
organisations = ["your-org"]
|
||||
Reference in New Issue
Block a user