Created
February 9, 2022 16:16
-
-
Save robinvanemden/72a632aa033f9d49c5090118a7343f72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
default_branch=`basename $(git symbolic-ref --short refs/remotes/origin/HEAD)` | |
git checkout --orphan tmp | |
git add -A # Add all files and commit them | |
git commit | |
git branch -D $default_branch # Deletes the default branch | |
git branch -m $default_branch # Rename the current branch to default | |
git push -f origin $default_branch # Force push default branch to github | |
git gc --aggressive --prune=all # remove the old files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment