Git
worktree 🌵Collaboration go brrrrr
TupperGit
:: 2023-06-29
Git stash
Git commit
Git clone
git
treesGit worktree
git
repository└── [drwxr-xr-x] repository
├── [drwxr-xr-x] .git
├── [-rw-r--r--] file0
├── [-rw-r--r--] file1
├── [-rw-r--r--] file2
└── [-rw-r--r--] file3
❯ git branch
coworker
main
* you
❯ git worktree add ../coworker coworker
Preparing worktree (checking out 'coworker')
HEAD is now at e39c79c Coworker
worktrees
├── [drwxr-xr-x] coworker
│ ├── [-rw-r--r--] .git
│ ├── [-rw-r--r--] file0
│ ├── [-rw-r--r--] file1
│ ├── [-rw-r--r--] file2
│ ├── [-rw-r--r--] file3
│ └── [-rw-r--r--] file4
└── [drwxr-xr-x] repository
├── [drwxr-xr-x] .git
├── [-rw-r--r--] file0
├── [-rw-r--r--] file1
├── [-rw-r--r--] file2
└── [-rw-r--r--] file3
git history
❯ /bin/cat coworker/.git
gitdir: [..]/repository/.git/worktrees/coworker
❯ cd coworker
❯ edit file3
❯ git commit -am "Fix typo"
[coworker 1be9375] Fix typo
1 file changed, 1 insertion(+), 1 deletion(-)
❯ git push
❯ cd ../repository
❯ git worktree list
[..]/repository 10b0086 [you]
[..]/coworker 1be9375 [coworker]
❯ git worktree remove ../coworker/
❯ git worktree prune
[drwxr-xr-x] .
└── [drwxr-xr-x] repository
├── [drwxr-xr-x] .git
├── [-rw-r--r--] file0
├── [-rw-r--r--] file1
├── [-rw-r--r--] file2
└── [-rw-r--r--] file3
Create a branch on the fly
git worktree add -b branch ../foo
Editors integration. Yes, even for the mighty one !