3

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.

  • 1
    This is *probably* a bug in `git subtree`, which has some known bugs. See the Git mailing list archive for details. There's nobody actively maintaining `git subtree` at the moment, as far as I know. – torek Oct 04 '21 at 07:57
  • Thanks for info @torek. As I am not in a position to help debug `git subtree`, it looks like I will need to look at replacing the use of `git subtree`. – Eddie Ridwan Oct 05 '21 at 02:06

1 Answers1

1

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...)

philb
  • 2,031
  • 15
  • 20
  • Thanks @philb. The `git subtree push` command now no longer complains about the missing commit. However, it still fails, where the debug messages show that a large number of commits are incorrect order. Here is an excerpt: `Using cachedir: /Users/eddieridwan/projects/jimmybox/public/premium/.git/subtree-cache/50582` `Looking for prior splits...` `Processing commit: 1fbbdda4f0ef15794eeb4a343d3fb1bf17fbb853` ` parents: c75f7cab156c91a1bf3b36658e1ac94dd1905bba` ` incorrect order: c75f7cab156c91a1bf3b36658e1ac94dd1905bba` – Eddie Ridwan Oct 07 '21 at 06:51
  • Could this be because incorrect info is now in the subtree-cache? Is deleting the cache something worth trying? Thanks. – Eddie Ridwan Oct 07 '21 at 06:59