Skip to content

Instantly share code, notes, and snippets.

@ckunte
Created September 2, 2017 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckunte/1a2b8d7d225782f800701fd7b1fe8403 to your computer and use it in GitHub Desktop.
Save ckunte/1a2b8d7d225782f800701fd7b1fe8403 to your computer and use it in GitHub Desktop.
Delete and recreate master
#!/usr/bin/env zsh
git checkout --orphan newBranch
git add -A
git commit -m 'first commit'
# Deletes the master branch
git branch -D master
# Rename the current branch to master
git branch -m master
# Force push master branch to github
git push -f origin master
# Remove old files
git gc --aggressive --prune=all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment