Skip to content

Instantly share code, notes, and snippets.

@RyanJeong
Created August 29, 2019 12:01
Show Gist options
  • Save RyanJeong/58301ef400f0ced40202ca611dad03d4 to your computer and use it in GitHub Desktop.
Save RyanJeong/58301ef400f0ced40202ca611dad03d4 to your computer and use it in GitHub Desktop.
A way to delete all commit history
# 1. Create orphan branch
$ git checkout --orphan temp
Switched to a new branch 'temp'

# 2. Add all files to newly created branch
$ git add .

# 3. Commit
$ git commit -m "The first commit"

# 4. Delete(force) master branch
$ git branch -D master

# 5. Move(rename) current branch
$ git branch -m master

# 6. Push changes
$ git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment