The answer provided by Ryan Thomson was heading to the right way. Still it would not be able to do the job (The details reason is given below).
The correct (and easiest) way of doing so is using
apt to pass dpkg option and force
dpkg to ask you whether you want to retain the modified config files or the original ones. The command will be like this -
sudo apt-get --reinstall -o Dpkg::Options::="--force-confask" install foo
This would ask you a question like
Configuration file '/etc/foo/foo.conf'
==> Modified (by you or by a script) since installation.
Version in package is the same as at last installation.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** foo.conf (Y/I/N/O/D/Z) [default=N] ?
You have to press either Y or I to install package maintainer's original config file. You can even press D to see what the changes or start a root shell with Z option to fix yourself.
Note: After the replacement, you'll find your modified file as
Why other options would not work?
Because the other options in dpkg doesn't work well. The options which deals with a package's config files are
--force-confmiss would not work when package version doesn't change. From man-page
If a conffile has been modified and the version in the package did change, always install the new version without prompting, unless the --force-confdef is also specified, in which case the default action is preferred.
--force-confmiss works with missing conffiles. It too will fail when version didn't change. Quoting man-page
confmiss: If a conffile is missing and the version in the package did change, always install the missing conffile without prompting. This is dangerous, since it means not preserving a change (removing) made to the file
--force-confold will retain modified version only if the version is changed. For same package, it too will fail. Quoting man-page
confold: If a conffile has been modified and the version in the package did change, always keep the old version without prompting, unless the --force-confdef is also specified, in which case the default action is preferred.
--force-confdef will also fail because the default action is to retain older file (Indicated from the message shown with
--force-confask. It has line
(Y/I/N/O/D/Z) [default=N] which means retaining is default. See above). And if
--force-confnew is specified but version do not change, that too will not work. Quoting man-page
confdef: If a conffile has been modified and the version in the package did change, always choose the default action without prompting. If there is no default action it will stop to ask the user unless --force-confnew or --force-confold is also been given, in which case it will use that to decide the final action.
--force-confask will work, because it will explicitly ask you the question even when the version is same. Quoting man-page
confask: If a conffile has been modified always offer to replace it with the version in the package, even if the version in the package did not change (since dpkg 1.15.8). If any of --force-confmiss, --force-confnew, --force-confold, or --force-confdef is also given, it will be used to decide the final action.
Hope that will help.