Colin Kiama
colinkiama.bsky.social
Colin Kiama
@colinkiama.bsky.social
All-round Creative - I create beautiful, delightful solutions that contribute back to the human experience.

https://colinkiama.com
Lastly, here's a link to Erik Schierboom's article on this to learn about how all of this works in more detail: www.erikschierboom.com/2020/02/17/c...
Cleaning up local git branches deleted on a remote
Introduction When using git, local branches can track remote branches that no longer exist (the remote branch is gone). To identify these branches, we first have to cleanup (prune) the remote’s bran...
www.erikschierboom.com
September 1, 2023 at 7:19 AM
Here's a link to my original blog post where I wrote about this last year: colinkiama.com/blog/git-swe...
Git Sweep Alias - Deleting stale local remote-tracking branches
Git cleaner repositories with one simple alias 😉
colinkiama.com
September 1, 2023 at 7:19 AM
That's it! You'll now be able to quickly clean up local branches with deleted remotes (Note: On Windows you may need to use a different terminal like Git Bash for this to work!) Thank you for reading!

(5/5)
September 1, 2023 at 7:18 AM
Here's an example of what the config file should look like with the alias added:

(4/5)
September 1, 2023 at 7:18 AM
You can set it using the `git config` command or by editing the your git config file directly. Here's the command to set the alias with the `git config` command:

(3/5)
September 1, 2023 at 7:17 AM
`git sweep` is a git alias I created that does the following: - Run the `git fetch --prune` command to delete all references to remote branches. - Find local branches linked to deleted remote branches (these are marked as "gone") then deletes them.

(2/5)
September 1, 2023 at 7:16 AM