Oscar
Oscar

Reputation: 5

Delete Commit in git History

How can delete one duplicate commit in Git ? I cannot push because I get the error:

error : duplicate commit

I can't seem to be able to delete this commit.

Upvotes: 0

Views: 109

Answers (2)

meatspace
meatspace

Reputation: 913

If you figure out what that ref is to:

git [log|branch|tag] | grep 95196f3b7ac656803cd4ed703d6d06b15e527e40

...then you can delete or push it, as appropriate.

Upvotes: 0

ElpieKay
ElpieKay

Reputation: 30858

If $br is empty, the checkout cmd creates a branch whose name is 95196f3b7ac656803cd4ed703d6d06b15e527e40 which points to HEAD. However it's also the name of a git object, the commit 95196f3b7ac656803cd4ed703d6d06b15e527e40. When you run git show 95196f3b7ac656803cd4ed703d6d06b15e527e40, git does not know to show HEAD or the true 95196f3b7ac656803cd4ed703d6d06b15e527e40. So it's ambitious.

Upvotes: 3

Related Questions