How Do I Sync Code from a Primary Database to a Derived Database Generated by Fork?
Symptom
In CodeArts Repo, you can fork the code repository of the primary repository to other projects for improved collaborative development. However, when the fork mode is used for development, the following problem may occur: After the primary repository (source project) is updated, you need to manually update the forked repository.
You can perform the following operations to sync the code of the primary library to the derived library generated by fork.
For example:
Primary repository address: https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/AlphaGo/TestService.git
Forked repository address: https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/Roger/TestService.git
Branch name: master
Solution
- Clone the forked repo in your personal space to the local host.
git clone https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/Roger/TestService.git cd TestService
- Add the remote original repository (primary repository) to the local host. (You can run the git remote -v command to view the remote repository list.)
git remote -v
- If there is no remote original repository, add the following information:
git remote -v origin https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/Roger/TestService.git (fetch) origin https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/Roger/TestService.git (push)
- Check the remote repository list.
git remote -v origin https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/Roger/TestService.git (fetch) origin https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/Roger/TestService.git (push) main https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/AlphaGo/TestService.git (fetch) main https://test.com/f2e22eeb1b8c43cfb764765f5e3ff039/AlphaGo/TestService.git (push)
- Obtain the latest branch code of the original repository (primary repository) to the local host and merge the code of the two versions.
git pull main master
- Sync the latest merged code to the fork repository.
git push origin master
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot