Question

I own two Git repositories:

  • ServerSide repository (conceptual name)
  • ClientSide repository.

ServerSide contains a client folder, empty initially, needing to be feed by the code from the latest commit of ClientSide's master branch at deployment time. (I only need to deploy ServerSide, since it is aiming to bring client with it)

What I would like is an automatic strategy to pull the content from ClientSide's master branch into ServerSide.

Indeed, until now, each time I want to deploy ServerSide, I use the manual (and very bad) strategy consisting in totally clearing the client folder (rm -rf * => very risky), launching a process (bash for instance) that grabs content from my ClientSide's (pure cp command) local master branch to the ServerSide's client folder and commit/push the whole.

What would be a really efficient strategy to do the trick automatically?

Was it helpful?

Solution

In this case, ClientSide could be added to ServerSide as a submodule.

In ServerSide: git submodule add <ClientSide> client

This creates a client directory linked with your ClientSide repository.

At deployment time:

cd client
git pull
# then commit the update of submodule client in ServerSide and deploy
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top