Skip to content

Instantly share code, notes, and snippets.

View T12z's full-sized avatar

Thorsten Schulz T12z

View GitHub Profile
@T12z
T12z / gist:b6bde764a55d9e8277b0c36543072f93
Created March 29, 2019 20:10 — forked from adeluccar/gist:d105299f2d5af55e3e96f9b989e7eb48
How to Flatten the History of a Git Repository Safely
git checkout --orphan future-master
git add -A  # Add all files and commit them
git commit
git branch -D master  # Deletes the master branch
git branch -m master  # Rename the current branch to master
git push -f origin master  # Force push master branch to github
git gc --aggressive --prune=all     # remove the old files