Home > OS >  What to enter for commit when trying to perform a git rebase?
What to enter for commit when trying to perform a git rebase?

Time:08-08

A week ago, I accidentally changed my email settings to public on GitHub. I then made about 20 commits that I discovered weren't showing up on my contribution chart. I have changed my email back to private and set my global git config to the private email again, so my new commits are working fine. However, I've been unable to figure out the git rebase command that I need to retroactively change the name/email on the old commits.

Below is the code that I'm pretty sure I need to run to fix my old commits, but I keep getting "zsh: no such file or directory."

What exactly do I need to put inside for this to work? And do I have to be in the correct repository folder in my terminal?

git rebase -r <some commit before all of your bad commits> \
--exec 'git commit --amend --no-edit --reset-author'

CodePudding user response:

If you need to rename the last 20 commits this should work. Put yourself in the root directory of your git repository and then send the command:

git rebase HEAD~20 --exec 'git commit --amend --author="YOURNAME <[email protected]>" --no-edit'

  • Related