Gitflow
📛Commits Have Wrong Author EmailMedium+500 XP
Workshop
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 config first, then amend the last commit, then rebase to fix the older ones.

Medium · 4 steps · +500 XP

What you will practice

This scenario walks through 4 steps, in order:

  1. 01Fix the local email config
  2. 02Amend the most recent commit to use the new author
  3. 03Rebase the last 4 to re-author them
  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. Amend the most recent commit to use the new author
    git commit --amend --reset-author --no-edit
  3. 3. Rebase the last 4 to re-author them
    git rebase -i HEAD~4 --exec 'git commit --amend --reset-author --no-edit'
  4. 4. Force push the rewritten branch
    git push --force-with-lease

Key takeaway

Set user.email globally on every machine to avoid this.