DEV Community

Serhii Kucherenko
Serhii Kucherenko

Posted on

1

How to update multiple git repositories for 1 project?

Alt Text

The problem

Image a situation where you started a project locally, developed some codebase and pushed that code to your github | gitlab | bitbucket. Then you ask your friend or a colleague to help with a feature. You added hime to the repo and we both work on 1 project. Then the client comes and says that he created an account on github and setup the auto-deploy to the server so you just need to push your code in their repo.

First solution

Simply copy the project, reinitiate the git config and change remote-url to the client's one. But then you change code in your repo & clone it to another manually. That's a stupid, time-consuming operation.

Right solution

So as a lazy developer, you don't want to do such things and you don't need to do it. You can configure your git to fetch data from your own repo and push new changes to both repos simultaneously.

git remote set-url --add --push origin path/to/YOUR/repo
git remote set-url --add --push origin path/to/CLIENT/repo
Enter fullscreen mode Exit fullscreen mode

After this, when you'll next time run git push the changes will be pushed to the both gits. Check it by yourself. Isn't that awesome?

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more