Recovering or reverting file changes is then done using your version control
system directly. Suppose, for example, that you have made a change in
/etc/bash.bashrc, the file that sets the defaults for your bash shell.
You read somewhere how to change the prompt and did not like the result.
However, because the changes are being tracked, you can roll it back to the
previous version. Because bzr is the default for etckeeper in Ubuntu,
here is how you do that with bzr. First, check the log to find the commit
number for the previous change:
Click here to view code image
matthew@seymour:~$ bzr log /etc/bash.bashrc
revno: 2
committer: matthew matthew@seymour
branch nick: seymour etc repository
timestamp: Tue 2018-07-16 11:08:22 -0700
message:
Changed /etc/bash.bashrc
revno: 1
committer: matthew matthew@seymour
branch nick: seymour etc repository
timestamp: Tue 2018-07-16 11:00:16 -0700
message:
Changed /etc/bash.bashrc
If you know the change was made in the most recent revision, denoted
revno 2 (for revision number two), you can revert to that version:
Click here to view code image
matthew@seymour:~$ bzr revert –revision 2 /etc/bash.bashrc
Today it is common for programmers, systems administrators, and developer
types to backup their dotfiles using version control. Dotfiles are the
configuration files and directories in a user’s /home directory, all of which
begin with a dot, like .bashrc. These are not necessarily backed up by all
software, and because they are often customized by highly technical people to
suit their desires, backing them up is a good idea. Version control systems are
commonly used. A program for Ubuntu called dotdee performs this task for a
different type of configuration file or directory that ends with .d and is stored
in /etc. You can find more information about dotdee in Chapter 9,
“Managing Software.”