hub icon indicating copy to clipboard operation
hub copied to clipboard

Deleting a remote synced branch produce exit 128 with `hub sync`

Open SebCorbin opened this issue 3 weeks ago • 0 comments

Opening a new issue since #2350 was not really resolved. I'm also quoting the last message to reproduce:

  • Creating local branch
  • Push all branches
  • Delete branch remote
  • hub sync > exit code 128
$ HUB_VERBOSE=1 git sync
$ git rev-parse -q --git-dir
$ git remote -v
$ git symbolic-ref refs/remotes/origin/HEAD
$ git symbolic-ref HEAD
$ git fetch --prune --quiet --progress origin
$ git config --get-regexp branch.*.remote
$ git branch --list
$ git config color.ui
$ git rev-parse --symbolic-full-name feature/php8.3-imagemagic-optout@{upstream}
$ git rev-parse -q refs/heads/feature/php8.3-imagemagic-optout refs/remotes/origin/master
exit status 128
$ hub --version
git version 2.43.0
hub version 2.14.2

Originally posted by @dandjo in #2350

The help command of hub sync is not really respected:

If the branch seems merged and its upstream branch was deleted, delete it.

In the meantime, for anyone experiencing this problem, I have this git alias (run it before hub sync):

$ git alias cleanup-merged
cleanup-merged = !git fetch -p && git branch --format '%(refname:short) %(upstream:track)' | awk '$2 == "[gone]" { print $1 }' | xargs git branch -D

SebCorbin avatar Dec 10 '25 09:12 SebCorbin