git-stripspace - Linux
Overview
git-stripspace removes trailing whitespace from commit messages. This helps keep commit logs clean and consistent.
Syntax
git stripspace [<options>] [<commit-range>]
Options/Flags
- -n, –dry-run: Dry run mode. Displays the commits that would be modified without making any changes.
- -a, –all: Apply to all commits in history.
- -i, –interactive: Interactively select which commits to modify.
- -f, –force: Forcefully apply changes without prompting for confirmation.
- –whitespace=
: Specify the type of whitespace to remove. Valid options are:trailing
,all
. Default:trailing
Examples
- Remove trailing whitespace from the latest commit:
git stripspace
- Remove whitespace from all commits in the branch:
git stripspace -a
- Interactively remove whitespace from specific commits:
git stripspace -i
Common Issues
- Commit messages are not modified: Verify that the commit messages actually contain trailing whitespace.
- Unexpected changes in commit message: Ensure that the whitespace removal does not alter the semantics of the commit message.
- Access denied: Ensure you have write permissions to the repository.
Integration
- Use alongside git-format-patch to ensure clean and consistent commit patches.
- Integrate with automated commit hooks to enforce whitespace removal on every commit.