How it works...

For each commit in the repository, Git will check the content of that commit and run tree-filter. If the filter fails with a non-zero exit code, filter-branch will fail. Therefore, it is important to remember to handle cases where tree-filter might fail. This is the reason why the previous tree-filter checks whether the .credentials file exists, runs the sed command if it does, and otherwise returns true to continue the filter-branch.

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.