I am trying to do a release with Nx. During the release process, it get an error about an unknown revision in my commit history.
This revision dates back to the initial setup of my repository.
I'm trying to use git rebase to either delete the second commit, or just squash all the commits into one
But whether i squash the commits, drop the second one, or try to adjust the commit message i get stuck in a never ending process of resolving merge conflicts going from root to HEAD.
Is there a simple way too just take revision 9facd74f and squash all the commits between it and a07a5ad3 so that it shows as only one "Initial commit" and I can resolve this issue of unknown revision?



The error about the missing commit is probably due to a shallow clone. Is that the case?
Anyway, to your question: create a new orphan branch on top of the commit that you want to use as the root of the new branch and commit it. Say the new branch is called
Xand the *original" commit from the original branch for it is calledoriginal-commit.Then, take the script from here: https://github.com/eantoranz/git-duplicate
Run it like this, assuming you are on
X[1]:It will print a commit id when it finishes running.... That commit has the history the way you are requesting it.... Place the branch you want on top of it if you like the result.
[1] On 2024/03/09 I adjusted the way the new base is provided (now there is the
--ontoargument to specify it. It isHEADby default). Old versions of the script had to be run like this: