• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“git reauthor” Command Examples

by admin

The “git reauthor” command is a feature provided by the “git-extras” package, developed by TJ Holowaychuk. This command allows you to change details about an author’s identity in Git history. It is particularly useful when you need to update or correct information such as the author’s name or email address associated with a commit.

Here’s a more detailed explanation of how “git reauthor” works:

1. Install “git-extras”: Before using the “git reauthor” command, you need to install the “git-extras” package. You can follow the installation instructions provided in the “git-extras” repository to set it up.

2. Correcting Author Details: Once the package is installed, you can use the “git reauthor” command to modify author information. The command syntax is as follows:

# git reauthor [old-name] [new-name] [new-email]

Replace [old-name] with the existing author name, with the corrected author name, and [new-email] with the corrected email address.

For example, if you want to change the author name from “Old Name” to “New Name” and the email address from “old@example.com” to “new@example.com,” you would run:

# git reauthor "Old Name" "New Name" "new@example.com"

3. Rewriting Git History: The “git reauthor” command rewrites the Git history by updating the author information for all the affected commits. It automatically searches for commits associated with the old author name and email address and replaces them with the new author details.

4. Pushing Changes: Since the “git reauthor” command modifies the Git history, you need to use the “–force” option when pushing the updated commits to a remote repository. This option ensures that the remote repository accepts the rewritten history. For example:

# git push --force

It’s important to exercise caution when using the “git reauthor” command because rewriting Git history can have significant implications, especially when collaborating with others. Rewriting history can create conflicts and cause problems for anyone who has already cloned or based their work on the existing commits.

Therefore, it is generally recommended to use the “git reauthor” command with caution and communicate the changes to other collaborators so that they can update their repositories accordingly.

git reauthor Command Examples

1. Change an author’s email and name across the whole Git repository:

# git reauthor --old-email old@example.com --correct-email new@example.com --correct-name "name"

2. Change the email and name to the ones defined in the Git config:

# git reauthor --old-email old@example.com --use-config

3. Change the email and name of all commits, regardless of their original author:

# git reauthor --all --correct-email name@example.com --correct-name name

Summary

In summary, the “git reauthor” command provided by the “git-extras” package allows you to modify author details in Git history. It helps correct or update information such as the author’s name or email address associated with commits. However, it’s important to be mindful of the implications of rewriting Git history and to communicate any changes to other collaborators.

Filed Under: Linux

Some more articles you might also be interested in …

  1. nmcli radio Command Examples in Linux
  2. gh codespace: Connect and manage your codespaces in GitHub
  3. lastlog: command not found
  4. funzip: Print the content of the first (non-directory) member in an archive without extraction
  5. lpr Command Examples
  6. doctl auth: Authenticate doctl with one or more API tokens
  7. dumpcap: A network traffic dump tool
  8. Linux OS Service ‘kudzu’
  9. krunvm Command Examples
  10. links Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright