💀

git worktree pruneでbranchは消えない 😇

2021/12/06に公開

消えると思って勘違いしてた...orz

git worktree prune した後に、 git branch -d も忘れずに.

同僚に指摘してもらったので、その時の実験メモ

--- add

$ git branch
* master
$ git worktree list
/private/tmp/sampleapp  9ed78d2 [master]
$ git worktree add -b "branch1" /tmp/dev/branch1 "9ed78d294bd69aeaddeaca9adc3dbf74ec66bb3b"
Preparing worktree (new branch 'branch1')
HEAD is now at 9ed78d2 :hatching_chick: initialized
$ git branch
+ branch1
* master

--- remove worktree

$ git worktree list
/private/tmp/sampleapp    9ed78d2 [master]
/private/tmp/dev/branch1  9ed78d2 [branch1]
$ git worktree prune
$ git worktree list
/private/tmp/sampleapp  9ed78d2 [master]
$ git branch
  branch1
* master

--- remove branch

$ git branch -d branch1
Deleted branch branch1 (was 9ed78d2).
$ git branch
* master

Discussion

ログインするとコメントできます