git-mailmask uses git-filter-repo and git push --force, which are highly destructive operations. If a user accidentally makes a typo in their new email address or targets the wrong repository, the original remote history is permanently overwritten.
We should introduce an Auto-Backup feature using Git's native bundle functionality to create a complete, single-file offline backup of the repository just before the history rewrite begins.
The command would look like this:
git bundle create backup_before_mailmask.bundle --all
To prevent bloating the user's hard drive with massive .bundle files, the backup should be managed smartly:
- Option 1: Delete if successfull: The script will create the backup, push to the repo if the user asks for it, and if it succeed we delete the backup.
- Option 2: Opt-in flag: Introduce a
--backup flag so it only runs if the user explicitly asks for it. (Less safe by default, but saves execution time on huge repositories).
- Option 3: OS Temp Directory: Always generate the backup but place it in
/tmp/ (Linux/macOS) or $env:TEMP (Windows) so the OS cleans it up automatically upon reboot.
git-mailmaskusesgit-filter-repoandgit push --force, which are highly destructive operations. If a user accidentally makes a typo in their new email address or targets the wrong repository, the original remote history is permanently overwritten.We should introduce an Auto-Backup feature using Git's native bundle functionality to create a complete, single-file offline backup of the repository just before the history rewrite begins.
The command would look like this:
git bundle create backup_before_mailmask.bundle --allTo prevent bloating the user's hard drive with massive
.bundlefiles, the backup should be managed smartly:--backupflag so it only runs if the user explicitly asks for it. (Less safe by default, but saves execution time on huge repositories)./tmp/(Linux/macOS) or$env:TEMP(Windows) so the OS cleans it up automatically upon reboot.