csWiki

the wiki of cscosine


Project maintained by cscosine Hosted on GitHub Pages — Theme by mattgraham

Table Of Contents

🔥 Git History Rewrite Procedure (Clean Identity Reset)

⚠️ WARNING: This rewrites commit history. All commit SHAs will change. Force push is required.


1️⃣ Work on a Mirror Clone

git clone --mirror git@github.com:USER/REPO.git
cd REPO.git

Note: a mirror is a full repo copy. It will clone in REPO.git folder.


2️⃣ Rewrite Author + Committer Identity + Remove Signatures

Install:

pip install git-filter-repo

Run:

git filter-repo \
  --name-callback 'return b"Your Name"' \
  --email-callback 'return b"your.email@email.com"' \
  --commit-callback '
    commit.gpgsig = None
  '

This rewrites:


3️⃣ Verify Clean History

Check metadata:

git log --all --pretty=format:"%an %ae | %cn %ce"

Search for unwanted strings:

git log --all --grep=OLD_STRING -i
git grep -i OLD_STRING $(git rev-list --all)

Check signatures:

git log --show-signature

This should not have any gpg: ... line.


4️⃣ Force Push Clean History

Re-add origin with:

note: see also Multi-Account GitHub SSH Setup (Clean and Safe) if you want to setup properly multiple accounts on the same machine

git remote add origin git@github.com:USER/REPO.git

or

git remote add origin https://github.com/USER/REPO.git

and then

git push --force --all
git push --force --tags

✅ Optional: Absolute Clean Reset

For maximum cleanup:

  1. Delete repository from GitHub
  2. Recreate it
  3. Push cleaned mirror again

This removes:


✅ Result

After this procedure: