GIT How to work in one codebase and multiple repositories

GIT How to work in one codebase and multiple repositories.

If you are working on your company local source code with git and you need to update the same version to customer repository, what you should do?

Currently, most of developers works on one remote origin for one project. But sometimes, there will be more than one repository with the same code structure. To save time and effort, working with more than one version controls for one project, please see bellow instruction.

  1. First you clone the repository that you are going to work on:
git clone YOUR_REPOSITORY_URL

The default origin will be named as origin if you view the remote version:

git remote -v

origin  YOUR_REPOSITORY_URL (fetch)

origin  YOUR_REPOSITORY_URL (push)

 

  1. Add remote repository to your project via terminal
git remote add YOUR_CUSTOMER_ORIGIN YOUR_ CUSTOMER _REPOSITORY_URL

After that, type the bellow command and the bellow result is correct

git remote -v

YOUR_CUSTOMER_ORIGIN YOUR_ CUSTOMER _REPOSITORY_URL (fetch)

YOUR_CUSTOMER_ORIGIN YOUR_ CUSTOMER _REPOSITORY_URL (push)

origin  YOUR_REPOSITORY_URL (fetch)

origin  YOUR_REPOSITORY_URL (push)
  1. Once per day, before leaving your office, you need to update the codebase to your customer repository, do it as below:
git pull YOUR_CUSTOMER_ORIGIN BRANCH_NAME

git push -u YOUR_CUSTOMER_ORIGIN BRANCH_NAME
  1. Doing the same thing before starting your work by getting the latest version update from customer repository
git pull YOUR_CUSTOMER_ORIGIN BRANCH_NAME

git push -u origin BRANCH_NAME

Do the same thing if you want to add another repository.

Contact https://bachasoftware.com