Ronak Agrawal
Ronak Agrawal

Reputation: 1066

Git Submodule or Git Subtree :What shoud I use to achieve below?

I have 2 projects: SUPERPROJECT and SUBPROJECT in different git remotes. I wish to make changes to SUBPROJECT and add file but not push it to remote of SUBPROJECT where it was cloned from.

I want to push the code for 'SUBPROJECT' to the remote repo of 'SUPERPROJECT' without pushing changes to acutual remote of 'SUBPROJECT'

Basically, actual remote for 'subproject'('ssh://..../prod/subproject') is some important repo where if code pushed for reivew, sends a notification to a wider audience.

I dont want to do that, i want to push 'SUBPROJECT' code(with somefile.js) to my 'superproject' so that i can test somefile.js.

I want code in my local repo for SUBPROJECT to be in the 'SUPERPROJECT' without pushing it to the remote of 'SUBPROJECT'.

P.S.: I tried with Submodules and not having a good experience. Don't have anything functional yet. Now I am not sure if I should invest time in going through Sub-Tree or just stick to Submodules.

Upvotes: 1

Views: 145

Answers (1)

Daiku
Daiku

Reputation: 1227

I think git submodule is still the way to go, but you can fork your own version of SUBPROJECT and push your changes to that until they get merged to the original. In SUPERPROJECT, you can switch back and forth which copy of SUBPROJECT to include. Different branches of SUPER could include different versions of SUB, for example.

Upvotes: 1

Related Questions