https://github.com/linuxeuphony/delete-old-git-branches
This is an automated bash script to delete git branches older than some specific time period.
https://github.com/linuxeuphony/delete-old-git-branches
git gitbash gitops
Last synced: 11 months ago
JSON representation
This is an automated bash script to delete git branches older than some specific time period.
- Host: GitHub
- URL: https://github.com/linuxeuphony/delete-old-git-branches
- Owner: LinuxEuphony
- License: mit
- Created: 2023-03-08T06:07:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T08:26:47.000Z (almost 3 years ago)
- Last Synced: 2024-12-31T02:25:13.724Z (about 1 year ago)
- Topics: git, gitbash, gitops
- Language: Shell
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# delete-old-git-branches






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
2. Below will run with preferred timeline set.
./delete-old-git-branches.sh 3
3. Below will run with default 4 months period and force delete unmarged branches enabled.
./delete-old-git-branches.sh -f
4. Below will run with the preferred time set and force delete unmarged branches enabled.
./delete-old-git-branches.sh -f 3