I have a project whose code is both in a personal repo and a team repo. I work on the personal repo and need to sync the changes to the team repo. Here are the instructions how to do it.
Assume the repo info is as below.
1 | > git remote -v |
Note that this is the command output in the team repo local copy directory. For the local personal repo, it’s not aware of the team repo. For the local team repo, you need to run the following command to make it be aware of the personal repo “upstream” first(adding the “upstream” remote url):
1 | git remote add upstream https://github.company.com/personal/demo-project.git |
For the personal repo, I just work on it and commit the changes as normal. When you want to sync the changes from the personal repo to the team repo, run the following commands in the local team repo directory:
1 | # 1. Get the changes to the "master" branch of the local repo. |
Done.