intersystems / intersystems/git-source-control
feature request: help users clean up branches removed from remote
- Dominant language
- ObjectScript
- Stars
- 22
- Forks
- 14
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 5
Description
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:
```shell
$ 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:
```shell
$ 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)
Contributor guide
Research direction
No implementation files, tests, or entry points are named. Start by locating the existing branch-management UI and the handlers for git fetch or branch listing; done means identifying branches whose remote tracking branch is gone, presenting them for selection, removing only selected branches, and tidying afterward as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100