Hacker News new | ask | show | jobs
by jmiserez 2526 days ago
>mark branches which are only local and have no remote, so you can easily purge old branches after they're merged.

  git fetch --prune
EDIT: Then you can see which ones don't exist on the remote

  git branch -v
which will show [gone] if it's a tracked branch but the corresponding upstream branch isn't there anymore. Use -vv to show the upstream branch names as well.

See:

- https://git-scm.com/docs/git-fetch#_pruning

- https://git-scm.com/docs/git-fetch

1 comments

git fetch --prune removes stale remote-tracking references, not local branches.
You are right. I've updated my comment above and added a second step which shows which branches can be removed.