Having trouble understanding what the normal usage patterns are.
The documentation could use a few examples of the sequences of commands need to do some common tasks. There's just something I'm missing about how to use this.
- Make a change in a subrepo-dir and push it to the external-repo
- Make a change in the external-repo and pull it into the subrepo-dir
- Make a change in the eternal-repo, and a also in the subrepo-dir and then syncronize them both
I have a mono repo, it looks like this:
/mono--/sub1--/something
I have a external-repo that looks like this:
/sub1
I have /sub1 cloned and inited in /mono/sub1.
git subrepo sub1 pull says everything is up to date
but when I try and push changes from /mono/sub1 I get an error saying mono/sub1 is behind.
What is the sequence of commands I would use to make a change to /mono/sub1 and then update /sub1 with those changes?
Do I need to commit /mono/sub1 first?
I agree that the documentation needs some more work, I am happy to accept patches. Your steps look like they should work. Can you get me actual output when attempting to do this?
Unfortunately, I cannot. We've done a bit more sleuthing and it looks like our problem is that our branch policy for the mono-repo is "squash merge". this means that the parent hash in the .gitrepo is lost during the squash.
master in the mono-repo no longer contains the parent. Then, on the next usage of subrepo we'll see errors like:
git-subrepo: Local repository does not contain 320c97a58f2c9d4c99a5d636c307b3d52c179e3a. Try to 'git subrepo fetch path/to/subrepo' or add the '-F' flag to always fetch the latest content
Is this something folks have encountered?
(If this answer seems off-topic from the original post, it's that we've been operating under the assumption that we just weren't using things correctly.)
That is a side effect of the subrepo methodology. I actually have a jenkins job to ensure that this doesn't happen on my repositories that use subrepo. I am open to answers about how this can be worked around if anyone has them.
A git hook for example could update the parent, but then you would need something like https://pre-commit.com to ensure that the hooks are installed and run appropriately. You would still need the CI to make sure everything stayed in sync.
https://stackoverflow.com/questions/61606259/feature-branching-using-git-subrepos