Created
May 17, 2022 16:06
-
-
Save eloyesp/07421a50945ca94036013f2af7c61a24 to your computer and use it in GitHub Desktop.
Cleanup a branch from layouthub
This file contains 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
# generate the diff | |
git diff --stat main > to_clean.stat | |
# remove everything you want to KEEP | |
vim to_clean.stat | |
# Filter | |
git filter-branch --index-filter "cat $(pwd)/to_clean.stat | | |
xargs git rm --cached --ignore-unmatch" \ | |
main..HEAD | |
# remove empty commits | |
git rebase -i main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment