0

We have a private Git repo with our project and we currently have another well-known repo in a subfolder there - as a subrepo (using https://github.com/ingydotnet/git-subrepo). When a new release of the well-known repo becomes available, we would like to have it in our repo. However, we have made some changes relevant to us in the subfolder. We don't want to commit our changes to the well-known repo, but we also don't want to lose them - we want to merge them with the new release.

Currently with "git surepo" I don't see a non-manual way to do it. There is no proper way to upgrade the subrepo to a release - one can pull the master without branches or tags, but for pulling a tag the only option is to do it from scratch, so the subrepo directory has to be deleted, which, obviously, erases all our changes.

We have looked at other alternatives to subrepo, but they don't seem to make life much better if they work in this case at all. Some of them are:

  • manually adding changes is the very last resort
  • have a separate repository (due to specifics of this project we are trying to avoid it, and it's obviously harder to maintain)
  • git submodule doesn't make it much better and adds other problems
  • git fork is possible, but involves a lot of work to get there and is pretty complex

I hope I have made the question clear. Any ideas here, please?

Flore
  • 1
  • 1
  • "have a separate repository" and "git fork" are actually the same solution. And it's THE solution. It doesn't remove all pains but it hurts the least. – phd Apr 06 '20 at 13:30
  • As @phd stated, `git fork` is the best. You will need a separate repository to store your revisions and a fork will store these revisions while still allowing you to pull new changes from the upstream repo. If you desperately need a temporary alternative to this, I guess you can use `git stash`, but I would recommend `git fork`. – Andrew Mascillaro Apr 06 '20 at 16:52
  • OK, I'm not sure why these are comments and not answers, but thanks, got the gist. – Flore Apr 08 '20 at 06:05

0 Answers0