TL;DR: there is a 6 year old commit and I just want it gone, I believe it is empty and I’d like to have it removed.
i.e. the commit at the very bottom:[a few thousand commits on top of this]
* 08d01075 – (5 years ago)
| * 2da4e798 – (5 years ago)
* | f29c0523 – (5 years ago)
* | a9a851d7 – (5 years ago)
* | d8e70b9b – (5 years ago)
| * 84a54eff – (5 years ago) new branch
* | 022bca02 – (6 years ago)
* | 79a5d079 – (6 years ago)
* | 5a89f05a – (6 years ago)
* | f02cc7f0 – (6 years ago)
* | 645ffc64 – (6 years ago)
* | 9693b596 – (6 years ago)
* 55555555 – (5 years ago) the null commit
The 55555555 is the one I wish to remove
I do not know how real this commit is, because of this:$ git diff 55555555^ 55555555
fatal: ambiguous argument ‘55555555 ^’: unknown revision or path not in the working tree.
Use ‘–‘ to separate paths from revisions, like this:’git
$ git show –no-patch 2bb15d71
Date: Tue Mar 12 11:01:54 2012
the null commit
You probably don’t actually want to do this, as mentioned in the comments.
But If you are sure that you do, you can run an interactive rebase:
git rebase -i –root
-i is a switch for interactive rebase.
–root is the first commit ever.
Delete the line of the commit that you want to remove, and save.
The issue with this technique is that the commit will remain on other contributors machines, and will be pushed to the remote repo when they make a change unless they follow the same steps you have. If you are working alone this should work.