Skip to content

Instantly share code, notes, and snippets.

@danielcharrua
Forked from manparvesh/git-cleanup.sh
Last active July 11, 2023 06:34
Show Gist options
  • Save danielcharrua/564ca15128ea16c70cdee48084e619e6 to your computer and use it in GitHub Desktop.
Save danielcharrua/564ca15128ea16c70cdee48084e619e6 to your computer and use it in GitHub Desktop.
Git remove all commits except the current one
#!/usr/bin/env bash
rm -rf .git
git init
git add .
git commit -m "Initial commit"
git remote add origin <git origin url>
git push -u --force origin <branch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment