Housekeeping
In this subtopic, we will highlight a number of best practices that can be applied toward maintaining a clean and operable repository through the following commands:
git clean
git gc
git prune
git clean
git clean
recursively removes untracked files from a working tree. This emphasizes that any file that is not staged to be tracked or reset is rid of, maintaining a versioned only directory. Normally, git clean
purges files through a list defined from a .gitignore
file, but in special cases, these rules can be ignored and any untracked file is cleared.
Let's complete the following exercise to understand the basic usage of git clean
.
Exercise 38: Removing Untracked Files using Git Clean
To remove untracked files from a working tree using git clean
, follow these steps:
- From the
track-it
repository, add a new file that collects output data for development, as shown in the following screenshot:Figure 5.73: Adding a new file for...