probably another approach is not to undo but simply re-install package if you know the details probably something like :
apt install <package)
or apt-get <package>
I'm on slackware, what i do is a print out of package information using ls:
ls /var/log/packages > /path/to/some/textfile