GitCleaner is a Ruby script that helps clean Git repositories by removing all commits and creating a new initial commit. It supports both GitHub repositories and Gists.
- Ruby 2.5 or higher
- Git
-
Clone this repository or download the
gitcleaner.rb
file. -
Make the script executable:
chmod +x gitcleaner.rb
-
Install required gems:
gem install dotenv
You can run GitCleaner in two ways:
./gitcleaner.rb --url <repository_url> --username <your_username> --password <your_password>
Example:
./gitcleaner.rb --url https://github.com/user/repo.git --username myusername --password mypassword
Create a .env
file in the same directory as the script with the following content:
GITURL=https://github.com/user/repo.git
USERNAME=your_username
PASSWORD=your_password
Then run the script without arguments:
./gitcleaner.rb