diff options
Diffstat (limited to 'blog/2021-05-30-changing-git-authors.org')
-rw-r--r-- | blog/2021-05-30-changing-git-authors.org | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/blog/2021-05-30-changing-git-authors.org b/blog/2021-05-30-changing-git-authors.org index 9e916a6..a41f5f3 100644 --- a/blog/2021-05-30-changing-git-authors.org +++ b/blog/2021-05-30-changing-git-authors.org @@ -1,33 +1,31 @@ -+++ -date = 2021-05-30 -title = "Changing Git Authors" -description = "Learn how to haphazardly replace Git authors and/or emails within the Git history." -+++ - -## Changing Git Author/Email Based on Previously Committed Email - -Here's the dilemma: You've been committing changes to your git repository with -an incorrect name or email (or multiple repositories), and now you want to fix -it. -Luckily, there's a semi-reliable way to fix that. -While I have never experienced issues with this method, some people have -warned that it can mess with historical hashes and integrity of commits, so -use this method only if you're okay accepting that risk. +#+title: Changing Git Authors +#+date: 2021-05-30 + +** Changing Git Author/Email Based on Previously Committed Email +:PROPERTIES: +:CUSTOM_ID: changing-git-authoremail-based-on-previously-committed-email +:END: +Here's the dilemma: You've been committing changes to your git +repository with an incorrect name or email (or multiple repositories), +and now you want to fix it. Luckily, there's a semi-reliable way to fix +that. While I have never experienced issues with this method, some +people have warned that it can mess with historical hashes and integrity +of commits, so use this method only if you're okay accepting that risk. Okay, let's create the bash script: -```sh +#+begin_src sh nano change_git_authors.sh -``` +#+end_src -The following information can be pasted directly into your bash script. The only -changes you need to make are to the following variables: +The following information can be pasted directly into your bash script. +The only changes you need to make are to the following variables: -- `OLD_EMAIL` -- `CORRECT_NAME` -- `CORRECT_EMAIL` +- =OLD_EMAIL= +- =CORRECT_NAME= +- =CORRECT_EMAIL= -```sh +#+begin_src sh #!/bin/sh # List all sub-directories in the current directory @@ -60,16 +58,16 @@ do cd .. done -``` +#+end_src Finally, save the bash script and make it executable. -```sh +#+begin_src sh chmod a+x change_git_authors.sh -``` +#+end_src Now you can run the script and should see the process begin. -```sh +#+begin_src sh ./change_git_authors.sh -``` +#+end_src |