Gitflow
📛Commits Have Wrong Author EmailMedium+500 XP
Scenario reference

Commits Have Wrong Author Email: the situation, step by step

The situation

You set up a new laptop and forgot to configure git. Last 4 commits show `you@old-job.com`. Your manager wants the company email everywhere.

Fix the config first, then re-author the tip with `--amend --reset-author`. The three older commits need a full history rewrite (`rebase --exec` or filter-repo), which needs an editor this terminal has not got.

Medium · 4 steps · +500 XP

What you will practice

This scenario walks through 4 steps, in order:

  1. 01Fix the local email config
  2. 02Confirm which identity Git will use from now on
  3. 03Re-author the most recent commit
  4. 04Force push the rewritten branch
Reveal the step-by-step commands

Try the terminal first — you learn more by doing. When you want to check yourself, here is the command for each step.

  1. 1. Fix the local email config
    git config user.email you@new-job.com
  2. 2. Confirm which identity Git will use from now on
    git config --list
  3. 3. Re-author the most recent commit
    git commit --amend --reset-author --no-edit
  4. 4. Force push the rewritten branch
    git push --force-with-lease

Key takeaway

`--amend --reset-author` re-stamps the commit you are sitting on; anything older needs a history rewrite. Set user.email globally on every machine and you never have to do either.