Skip to content

feature request: help users clean up branches removed from remote #994

Description

@cambot

If you are in the habit of checking out and running other team members branches as part of your QA workflow, then these branches can accumulate over time and can quickly clutter up the UI unless devs stay on top of deleting branches once they are done using them. Git itself offers a few ways to know when a remote tracking branch has been removed. It would be nice if Embedded git offered a way to key into this and help the user bulk remove these branches.

Observation 1

git fetch origin --prune will not only update all remote tracking branches, but it will also remove any that are no longer present in the remote repo. While it will not remove any corresponding local branches, it does print out which remote branches it removed:

$ git fetch origin --prune
From github.com:user/repo
 - [deleted]     (none)     -> origin/feature/branch

If any of these branches exist locally, an option could be presented to the user to remove or keep them.

Observation 2

git branch offers an option which provides an indicator as to whether or not the local repo is still aware of the remote tracking branch:

$ git branch -v
  feature/untracked-branch     abcdef1 commit message
  feature/tracked-branch       1234567 [gone] commit message

Every branch containing [gone] could be presented to the end user to decide if they want to keep or remove it.

UI Suggestion

However Embedded Git determines that a local branch no longer has a remote partner, it could present them all in a checkbox list to the end user (similar to the list of uncommitted files, including a "Select All" option). Once the user makes their selection, they can remove them with a single button click.

(Loop through the list to git branch -D {{branch name}} and then run git gc to tidy up afterwards)

Metadata

Metadata

Assignees

No one assigned

    Labels

    customerBased on customer feedback (as opposed to something identified by developers)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions