Eddie Ridwan
Eddie Ridwan

Reputation: 41

Git push subtree fail unknown revision or path possibly due to missing git-subtree-split commit

I have been using git subtree to embed a repo within a folder of our main project. I am not sure what has happened, but pushing the subtree now fails to update the remote repo.

The command I use to push is:

git subtree push --prefix themes/natra https://github.com/OpenSID/tema-natra.git premium

The error message is:

   fatal: ambiguous argument '3f44cc87ceb87df1d9171096596a824fc3050a27^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
could not rev-parse split hash 3f44cc87ceb87df1d9171096596a824fc3050a27 from commit 8577911bf6183497cc246aa620e7be1b6becec29

I am not able to find the commit/hash 3f44cc87ceb87df1d9171096596a824fc3050a27 in the repo. In the following gitx image Commit is git-subtree-split, I can see that the commit is a git-subtree-split. But it appears to no longer exist in the repo.

How can I bypass or recover from this apparent missing commit? Any help would be greatly appreciated.

Upvotes: 4

Views: 1794

Answers (1)

philb
philb

Reputation: 2970

As I answered to you on the Git mailing list, this happens because the premium branch at https://github.com/OpenSID/tema-natra.git was force-pushed.

To work around this, simply fetch the commit by its hash (it's still available on GitHub):

git fetch https://github.com/OpenSID/tema-natra.git 3f44cc87ceb87df1d9171096596a824fc3050a27

and then you should be able to run your git subtree push command (though you might need to force-push...)

Upvotes: 2

Related Questions