Skip to content
  • Kazuki Yamaguchi's avatar
    branch -m: update all per-worktree HEADs · 70999e9c
    Kazuki Yamaguchi authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When renaming a branch, currently only the HEAD of current working tree
    is updated, but it must update HEADs of all working trees which point at
    the old branch.
    
    This is the current behavior, /path/to/wt's HEAD is not updated:
    
      % git worktree list
      /path/to     2c3c5f2 [master]
      /path/to/wt  2c3c5f2 [oldname]
      % git branch -m master master2
      % git worktree list
      /path/to     2c3c5f2 [master2]
      /path/to/wt  2c3c5f2 [oldname]
      % git branch -m oldname newname
      % git worktree list
      /path/to     2c3c5f2 [master2]
      /path/to/wt  0000000 [oldname]
    
    This patch fixes this issue by updating all relevant worktree HEADs
    when renaming a branch.
    
    Signed-off-by: default avatarKazuki Yamaguchi <k@rhe.jp>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    70999e9c