Skip to content

Instantly share code, notes, and snippets.

@manparvesh
Created June 2, 2019 04:51
Show Gist options
  • Select an option

  • Save manparvesh/033aef080542b986f4bdbf3f3366010e to your computer and use it in GitHub Desktop.

Select an option

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>
@jcgohr
Copy link
Copy Markdown

jcgohr commented Apr 29, 2024

Worked for me

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