Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save browol/bd01e5da06b0047b9a149c9dbe17f365 to your computer and use it in GitHub Desktop.

Select an option

Save browol/bd01e5da06b0047b9a149c9dbe17f365 to your computer and use it in GitHub Desktop.

Revisions

  1. browol revised this gist Aug 16, 2023. 2 changed files with 4 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
    4 changes: 4 additions & 0 deletions remove-local-branches.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    How to remove local Git branches that do not exist on the remote server?
    ```bash
    git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
    ```
  2. David created this gist Oct 30, 2017.
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done