Reputation: 125
I have an old git repo with a ton of cruft. I'd like to permanently delete every file in the history that isn't referenced by HEAD to free up space on the server. Is there a way to do this?
Upvotes: 0
Views: 63
Reputation: 12445
git clean -d -x -f
removes all untracked files and directories and ignored ones. If you want to test it without affecting the repository change -f
with -n
to run the command in dry-run mode.
If you want to clean instead all tracked files, in my opinion is better to copy youw project in a new folder (with all ignored/untracked files removed) and start a new repository, mantaining the old one as backup for some time.
Upvotes: 3