Public

Public

#GitHub #git #github
How do I remove the old history from a git repository?
How do I remove the old history from a git repository?
I'm afraid I couldn't find anything quite like this particular scenario. I have a git repository with a lot of history: 500+ branches, 500+ tags, going back to mid-2007. It contains ~19,500 commit...
If you want to free some space in your git repo, but do not want to rebuild all your commits (rebase or graft), and still be able to push/pull/merge from people who has the full repo, you may use the git clone shallow clone (--depth parameter). ; Clone the original repo into limitedRepo git clone file:///path_to/originalRepo limitedRepo --depth=10 ; Remove the original repo, to free up some space rm -rf originalRepo cd limitedRepo git remote rm origin You may be able to shallow your existing repo, by following these steps: ; Shallow to last 5 commits git rev-parse HEAD~5 > .git/shallow ; Manually remove all other branches, tags and remotes that refers to old commits ; Prune unreachable objects git fsck --unreachable ; Will show you the list of what will be deleted git gc --prune=now ; Will actually delete your data
·stackoverflow.com·
How do I remove the old history from a git repository?
Untrack Folder in Git | Delft Stack
Untrack Folder in Git | Delft Stack
If I add a folder (or file) to .gitignore but I've already made commits that include that folder you have to do this to untrack the folder.
·delftstack.com·
Untrack Folder in Git | Delft Stack