# reset email multiple commit

I started not to use my real email for git commit. Instead i uses the one that is provided by [github](https://help.github.com/articles/about-commit-email-addresses/)

After enabling **Block command line pushes that expose my email** on [Block command line pushes that expose my email](https://github.com/settings/emails), it will reject all email that exposes public email adress.

So in order to rewrite git history and change the author email, I found this [github help](https://help.github.com/articles/changing-author-info/)

```bash
#!/bin/sh

git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
```

Another neat way (after you change your email with git config), you can also do this:

```bash
$ git rebase -i -p --exec 'git commit --amend --reset-author --no-edit'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.yulrizka.com/git/reset-email-multiple-commit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
