Reputation: 1137
I'm cleaning up binary files in a Git repo and I have a long list of files I removed with git rm
.
Given the scale of the change (7000+ files) I'm now thinking it's more prudent to have used git rm --cached
instead.
The files are in staging, how do I put them back on disk while keeping them out of git ?
I'm looking for a git command to do this, I'd like to avoid some nasty script hack where I git co
then git rm --cached
each file. Once I check them out I won't know which ones I need to delete again and I'd have to redo my work. It's a long list of specific subdirectories, not a straightforward case of rm -r *
Upvotes: 1
Views: 267
Reputation: 28981
Just commit your staged deletions and then you could retrieve files from historical commit by git checkout HEAD~1 -- .
, where you could replace .
with a path(s) you want to retrieve.
Upvotes: 1
Reputation: 142412
To clean up your repo you should use :
https://rtyley.github.io/bfg-repo-cleaner/
To get your files you simply checkout the desired commit and it will checkout the files to your working directory.
Upvotes: 0