2

I have a commit with different username. On top of that I have a commit with correct username which I want to keep.

I want to delete only the first commit which has wrong username.

karthikeayan
  • 2,278
  • 3
  • 26
  • 48

1 Answers1

2

If you wish to keep the orders of commits, then you would need to use filter-branch or rebase -i, as mentioned in "Change the author of a commit in Git".

But keep in mind it will change the SHA1 associated to that commit (and any commits after said amended commit), which means you will have to force push, and any collaborator would have to reset his/her own local repo to that new fetched content.


I need to completely remove the history

That is best done with a git rebase -i (interactive rebase), where you can drop any commit you want during the interactive session.
See "Rebasing commits against a point in time".

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283