Reputation: 7695
I made a boo-boo. I forgot to add something before I committed. I pushed. Then I realized my mistake and amended the commit and tried to force push (no one else could have gotten the commit yet, don't stone me!) but force pushing was disabled. I was able to fix my history and push. Here it is below:
* 46b65b5 Amend previous commit (c1672ab8671) with some missed changes
* c1672ab Clean, rescope, and manage dependencies after running mvn dependency:analyze
| * 7eb0c6a (tag: oops) Revert "Clean, rescope, and manage dependencies after running mvn dependency:analyze"
| * 385f1b6 Clean, rescope, and manage dependencies after running mvn dependency:analyze
|/
* f13ce81 Manage all dependencies at the top level pom
Here is the remote history, notice the abscence of 385f1b6
and 7eb0c6a
* 46b65b5 Amend previous commit (c1672ab8671) with some missed changes
* c1672ab Clean, rescope, and manage dependencies after running mvn dependency:analyze
* f13ce81 Manage all dependencies at the top level pom
385f1b6
and 7eb0c6a
are nothing but a shameful reminder to double check my commits before pushing and make my local graph ugly. How can I get rid of them? Reminder: they are not on the team's repository, no one else has them, they are my sole shame I wish to erase from memory.
I tagged it oops
while I was following some tutorial on how to fix this type of issue or something similar, but it didn't explain how to actually get rid of these commits.
In defense of this not being a duplicate: As @hvd stated,
"Not a duplicate of that. Deletion from the visible history and physical deletion from the hard drive are two very distinct kinds of deletions. This question asks for the former, the other asks for the latter."
Upvotes: 2
Views: 508
Reputation: 37712
probably the tag (and maybe a branch) make thos commits show up in your history. For starters, delete the tag:
git tag -d oops
now if those two commits you want to get rid of are on a branch (you might use git log --all --decorate --oneline --graph
to get a clear vision of your history), then you need to delete that branch as well:
git branch -d <oops-branch>
Upvotes: 3