Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michaelcurrin/rewrite-git-author
The easy way to replace an email address across all commits in a repo
https://github.com/michaelcurrin/rewrite-git-author
author bash commit git-author rebase shell tool
Last synced: 3 months ago
JSON representation
The easy way to replace an email address across all commits in a repo
- Host: GitHub
- URL: https://github.com/michaelcurrin/rewrite-git-author
- Owner: MichaelCurrin
- License: mit
- Created: 2021-06-24T17:37:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-11T13:35:39.000Z (about 2 years ago)
- Last Synced: 2024-04-28T05:03:44.463Z (8 months ago)
- Topics: author, bash, commit, git-author, rebase, shell, tool
- Language: Shell
- Homepage: https://michaelcurrin.github.io/rewrite-git-author/
- Size: 57.6 KB
- Stars: 19
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rewrite Git Author
> The easy way to replace an email address across all commits in a repo[![GitHub tag](https://img.shields.io/github/tag/MichaelCurrin/rewrite-git-author?include_prereleases=&sort=semver)](https://github.com/MichaelCurrin/rewrite-git-author/releases/)
[![License](https://img.shields.io/badge/License-MIT-blue)](#license)[![Made with Bash](https://img.shields.io/badge/Bash->=3-blue?logo=gnu-bash&logoColor=white)](https://www.gnu.org/software/bash/)
A simple tool to replace the email address for all commits in a repo by a user - using a single command. The timestamps and patches of the commits are left as is.
## ⚠️ **Warning**
Since a rebase is done here, this tool rewrites your Git history of commits. So you'll have to force-push your changes and get everyone to pull in the changes.
Further, _every_ commit in the history back to the _first_ commit will get rewritten, even if _nothing_ changed in the commits. So don't use this to just fix a few recent commits - rather fix those by hand, or submit an issue or PR improve this tool to only go back to a certain commit!
See further warnings in the [git filter-branch][] docs.
[git filter-branch]: https://git-scm.com/docs/git-filter-branch
## Sample usage
Run the shell script:
```sh
$ rewrite_author.sh OLD_EMAIL NEW_MAIL
```Then check your Git log and force push if you're satisfied.
e.g. If your ran this:
```sh
$ rewrite_author.sh [email protected] [email protected]
```Then your commits will be changed from the old email like:
```
Author: Foo Bar [email protected]
Date: Thu Jun 24 20:08:18 2021 +0200
```To the new email:
```
Author: Foo Bar [email protected]
Date: Thu Jun 24 20:08:18 2021 +0200
```## Alternative
Instead of using this tool, see [git filter-name](https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/version-control/git/commands/filter-name.html).
## Documentation
[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=for-the-badge)](https://michaelcurrin.github.io/rewrite-git-author/ "Go to project documentation")
See that for how to set up and run this tool and for more info on how this works.It also has instructions for how to update an email address for a _single commit_ with plain Git.
## License
Released under [MIT](/LICENSE) by [@MichaelCurrin](https://github.com/MichaelCurrin).