I'm simultaneously working with my github repositories and client git repository. Today, I did modifications on my git code and unexpectedly committed with client credentials. After commit I realised that I committed the code with client username and email, then I set git config --global user.name "myname"
and git config --global user.email "ex@gmail.com"
to push the code to my repo. Code pushed successfully. But my problem is, I can see the commit was made by client credentials. And also his name added to contributors list. You can see below
How can I remove him from my contributors and I want to undo the push completely. Thanks in advance.
Asked
Active
Viewed 817 times
2

Pavan kumar Dasireddy
- 346
- 5
- 19
-
1https://stackoverflow.com/q/3042437/1030675 – choroba Oct 05 '18 at 08:14
1 Answers
7
If this is the last commit, you can edit the message and reset the author with git commit --amend --reset-author
to set it to your current config.
Then, you have to git push --force
the push to remove the commit with the wrong author.
If this is not the last commit, you can use git rebase --interactive
and reset the commit you want.

Asenar
- 6,732
- 3
- 36
- 49
-
Unfortunately, I did `git revert e4dc6fd `. What should I do now? – Pavan kumar Dasireddy Oct 05 '18 at 08:55
-
If this is the last commits, you can do `git reset HEAD^` to cancel the last commit. Or you can do `git rebase --interactive e4dc6fd^` (I assume `e4dc6fd` is the commit you want to change the author), then mark the commit `e4dc6fd` to edit it, then close the editor to run the rebase, and when it stops, do `git commit --amend --reset-author` – Asenar Oct 05 '18 at 09:01
-
To check what your previous git history looks like, you can do `git log --all --decorate --graph --pretty=oneline --topo-order` – Asenar Oct 05 '18 at 09:02
-