martes, 22 de diciembre de 2009

1984. You never pushed that.

Rewriting history is one of those things we all would want to do at least once in our lives.

Well, unfortunately, I don't have a solution for that, but in the computer world, you know... we even have ctrl-z !

But when things are uploaded to external server or repository, it's not that easy. Until git.

I accidentally pushed a 600Mb file to a git repo that (luckily) never changed, but when I cloned the repo, I had to wait for several minutes until git downloaded the 30+ Mb file (git, or at least github compress files).
git filter-branch -f --index-filter 'git update-index --remove filename' HEAD
git push --force --verbose --dry-run
git push --force
With just theese lines, you can pretend you never uploaded it. The only thing to keep in mind is that you should work on a up to date working copy.

Now you could even convince Winston Smith in room 101 that a given file never existed.

Scared? Yeah, you should be.

No hay comentarios: