Skip to content

Instantly share code, notes, and snippets.

@manparvesh
Created June 2, 2019 04:51
Show Gist options
  • Save manparvesh/033aef080542b986f4bdbf3f3366010e to your computer and use it in GitHub Desktop.
Save manparvesh/033aef080542b986f4bdbf3f3366010e 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>
@jgore077
Copy link

Worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment