Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save filoscoder/7a407be1fdbcf21c75f458c2841c6b96 to your computer and use it in GitHub Desktop.
Save filoscoder/7a407be1fdbcf21c75f458c2841c6b96 to your computer and use it in GitHub Desktop.

Revisions

  1. @trey trey revised this gist Mar 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-commit-author-rewrite.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ If you need to change the author for a commit older than the most recent, do a `
    $ git rebase -i HEAD~2
    ```

    Then choose `e` or `edit` next to the appopriate commit, then when it asks you to ammend, run the same command as you would for the most recent commit:
    Then choose `e` or `edit` next to the appopriate commit, then when it asks you to amend, run the same command as you would for the most recent commit:

    ```bash
    $ git commit --amend --reset-author
  2. @trey trey revised this gist Mar 16, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commit-author-rewrite.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Change the email address for a git commit.

    ```bash
    $ git commit --amend --author="Author Name <[email protected]>"
    ```
  3. @trey trey created this gist Mar 16, 2014.
    31 changes: 31 additions & 0 deletions git-commit-author-rewrite.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    ```bash
    $ git commit --amend --author="Author Name <[email protected]>"
    ```

    or

    ```bash
    $ git commit --amend --reset-author
    ```

    If you need to change the author for a commit older than the most recent, do a `git rebase -i`. For example, if you wanted to change the penultimate commit, you'd run:

    ```bash
    $ git rebase -i HEAD~2
    ```

    Then choose `e` or `edit` next to the appopriate commit, then when it asks you to ammend, run the same command as you would for the most recent commit:

    ```bash
    $ git commit --amend --reset-author
    ```

    Then, to finish, you'd run:

    ```bash
    $ git rebase --continue
    ```

    And you're done. Don't forget you'll have to `--force` push if you've already pushed those commits to your remote.

    [source](http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git)