1

Alright, so I commited some changes with a git username that was saved on my work laptop. After I changed the git username and useremail and pushed the branch to the remote repo, I have several commits under the initial username, and others under the changed username.

Is it possible to either undo the commits under the initial username, merge them into a commit with the current username and push the branch with one single commit that has the changed username ?

  • Possible duplicate of [How to change the author and committer name and e-mail of multiple commits in Git?](https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi) – phd Sep 22 '18 at 08:11
  • https://stackoverflow.com/search?q=%5Bgit%5D+change+commit+email – phd Sep 22 '18 at 08:12

1 Answers1

0

Assume you have 3 commits you want to retract and squash into one:

git reset --soft HEAD~3
git commit
git push -f

First, reset Git HEAD to the point before those commits, preserving all content. Then create a new commit as usual, with current names, and force push to override the commits on GitHub.

iBug
  • 35,554
  • 7
  • 89
  • 134