Réécrire son historique Git (et vite)

À la main … c’est long
Avec les bons outils … c’est mieux
git filter-branch -f --env-filter '  OLD_EMAIL="old.email@example.com"
CORRECT_NAME="New Name"
CORRECT_EMAIL="new.email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
git push -f --tags origin HEAD:main
git update-ref -d refs/original/refs/heads/main

--

--

--

Developer @ConsenSys // Blockchain enthusiast // Engineer @ EPF

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alain Nicolas

Alain Nicolas

Developer @ConsenSys // Blockchain enthusiast // Engineer @ EPF

More from Medium

Software Version

Version Controlling

A Byte of Coding Is

Software Outsourcing Strikes Back