On This Page

How to Change Git Commit Author Name and Email

Quick Answer: To change the author name/email of the last commit, run git commit --amend --author="Name <email@example.com>" --no-edit. To update author details for multiple past commits, use an interactive rebase (git rebase -i) — full walkthrough below.

⚠️ Read this first: both methods rewrite history. If the commits are already pushed, you’ll need git push --force afterwards and anyone with a copy of the old history will hit conflicts — coordinate with your team before force-pushing. Fixing commits you haven’t pushed yet is always safe.


1. Change Author of the Most Recent Commit

If you just made a commit with the wrong user identity:

$ git commit --amend --author="Jane Doe <jane@example.com>" --no-edit

Verify the update by checking the last log entry:

$ git log -1 --format="Author: %an <%ae>"
# Output: Author: Jane Doe <jane@example.com>

2. Change Author for Multiple Past Commits (git rebase -i)

Step 1: Start Interactive Rebase

$ git rebase -i HEAD~4

Step 2: Mark Commits with edit

In the editor list, change pick to edit (or e) for every commit whose author you want to fix:

edit a1b2c3d Feature commit 1
pick 2b3c4d5 Feature commit 2
edit 3c4d5e6 Feature commit 3

Save and exit.

Step 3: Update Author and Continue

Git will pause at each edit commit. Run:

$ git commit --amend --author="Jane Doe <jane@example.com>" --no-edit
$ git rebase --continue

Repeat until the rebase finishes.


3. Prevent Future Wrong Authors (git config)

To ensure you don’t commit with the wrong author in the future, set your global identity:

$ git config --global user.name "Jane Doe"
$ git config --global user.email "jane@example.com"

For project-specific work (e.g. work vs personal email), set local repo config:

$ git config --local user.email "jane@company.com"

Read our /git-config guide for details on configuration hierarchy.