Skip to content

Instantly share code, notes, and snippets.

@mbaykara
Last active June 13, 2022 11:52
Show Gist options
  • Select an option

  • Save mbaykara/86b6e51940b21c0d0af0a58cd537eb1b to your computer and use it in GitHub Desktop.

Select an option

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
#!/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