til/git/clone-to-worktree.md

18 lines
409 B
Markdown
Raw Permalink Normal View History

2022-08-23 15:46:16 +02:00
# Clone to worktree
Git branches is like an antipattern.
Its best to use `git worktree` to have already checked out git branches.
## Cloning
git clone https://git.xsfx.dev/xsteadfastx/til.git til/main
This will create the directory `til` and clones the branch `main` into it.
## Create new worktree
cd til/main
git worktree add ../foo main
This will create the worktree `foo` in `til/foo`.