Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💼
Engineering

David Kariuki (DK) david-kariuki

👨‍💼
Engineering
View GitHub Profile
@david-kariuki
david-kariuki / git-delete-branches-older-than-period
Last active February 23, 2023 11:39
This is an automated bash script to delete git branches older than some specific time period. The default set time is 3 months, but you can pass the period in months as a first parameter while running the shell script. The script will by default exclude master and main and development branch. You can add more
View git-delete-branches-older-than-period
#!/bin/sh
:'
This is an automated bash script to delete git branches older than some specific time period.
The default set time is 3 months, but you can pass the period in months as a first parameter while running the shell script
'
declare -i numberOfMonths=3 # Declare the default period in months
declare blackListedBranches # Blacklisted branches
clear=clear # Command to clear terminal
ECHO='echo ' # Custom echo