Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefanopisano/repo-cleaner
Simple shell script to clean GIT repositories
https://github.com/stefanopisano/repo-cleaner
git repository shell shell-script utilities
Last synced: about 2 months ago
JSON representation
Simple shell script to clean GIT repositories
- Host: GitHub
- URL: https://github.com/stefanopisano/repo-cleaner
- Owner: StefanoPisano
- Created: 2023-01-25T12:00:46.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-25T13:03:17.000Z (almost 2 years ago)
- Last Synced: 2024-04-16T18:18:22.396Z (9 months ago)
- Topics: git, repository, shell, shell-script, utilities
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# repo-cleaner
Simple shell script to clean GIT repositories## Install
1. Clone the repository and get the script
2. Open it with your favourite text editor (Notepad++, Notepad, IDEA or whatever you want)
3. Set your parameters (directories, origin names, filtered branches)
4. Launch it
5. Get results in your final-report.txt file (created inside the reports folder) and launch them into the terminal## Personalization
`baseDir` home directory for your user
`baseScriptDir` directory where the script has been saved
`prjDir` directory of your GIT project
`timestamp` timestamp used to generate reports folders, by default it will generate something like that: 20230123_1115
`filteredBranches` branch to exclude from the final report## Functions
`CreateDirIfNotExists()` It will look for a directory named with the current timestamp, if not exists it will create it
`ListMergedBranchesToFile()` Create a file named original-report.txt with the full list of branches merged inside master
`FilterReportToFile()` Based on the original-report it filters the branches you indicated on the `filteredBranches` variable
`EmptyFileIfExists()` If the final-report.txt file already exists this function will clear it
`WriteFinalReport()` Iterate over the pre-final-report.txt and generates git commands to delete the remote branches. It doesn't delete anything, it will only generates the commands## Automatic clean up
You could also execute the script passing `execute` as argument, in that case the script will execute all commands inside the final-report.txt file. **at your own risk :D**