Skip to content

[Feature] Auto-backup via git bundle before rewriting history #1

Description

@Cold-FR

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions