Skip to content

This is an automated bash script to delete git branches older than some specific time period.

License

Notifications You must be signed in to change notification settings

LinuxEuphony/delete-old-git-branches

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

delete-old-git-branches


GitHub issues GitHub Contributions repo size GitHub forks GitHub stars GitHub LastCommit


This is an automated bash script to delete git branches older than some specific time period. The default set time is 4 months, but you can pass the period in months as a first parameter while running the shell script



How to download the script

GIT Clone Option

  1. Navigate to your preferred directory
  2. Run terminal
  3. Type git clone https://github.com/LinuxEuphony/delete-old-git-branches to clone repository
  4. Navigate to the folder named delete-old-git-branches

Github Download Option

To download and use this script:

  1. Click on code on this page.
  2. Click on Download Zip.
  3. A files named delete-old-git-branches-main.zip will be downloaded. Extract the zip file in your computer. You will see a folder labelled delete-old-git-branches-main.
  4. Navigate to that folder.


How to run the file

  1. Navigate to and edit the file named delete-old-git-branches.sh. Replace the value YOUR_REMOTE_OR_LOCAL_GIT_URL on line 13 with your remote/local git url.
  2. Open the terminal inside the, or navigate through terminal into the folder named delete-old-git-branches-main
  3. Type chmod +x delete-old-git-branches.sh and click on enter key to make the script executable.
  4. Type ./delete-old-git-branches.sh to run the script.

Run options

  1. Below will run with the default 4 months period.
./delete-old-git-branches.sh
  1. Below will run with preferred timeline set.
./delete-old-git-branches.sh 3
  1. Below will run with default 4 months period and force delete unmarged branches enabled.
./delete-old-git-branches.sh -f
  1. Below will run with the preferred time set and force delete unmarged branches enabled.
./delete-old-git-branches.sh -f 3



About

This is an automated bash script to delete git branches older than some specific time period.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages