Last active
June 13, 2022 11:52
-
-
Save mbaykara/86b6e51940b21c0d0af0a58cd537eb1b to your computer and use it in GitHub Desktop.
Clean your git history and get rid of commits you want to disappear from the git history. Git, GitLab, GitHub etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env bash | |
| #run this script in your git project | |
| URL=$(cat .git/config | grep url | cut -d\ -f3) | |
| rm -rf .git | |
| git init | |
| git add . | |
| git commit -m "Initial commit" | |
| git remote add origin $URL | |
| git push -u --force origin main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment