Collaborating on Git & GitHub – Remote Repository
Collaborative coding is typically managed through a Remote Repository. A Remote Repository is a place where committed files are stored on the web and can be shared with others. GitHub, GitLab, or Bitbucket are the major remote repository services.
Interactions between a Local Repository and a Remote Repository are done through the command line on a local computer or a desktop application provided by remote repository services.
The following steps are an example flow to share project files and collaborate with a team member.
Example: Developer A initiates a project, and Developer B supports Developer A
- Developer A works on coding and makes the first Commit (saved in his Local Repository).
- Developer A sends the committed files to his Remote Repository. This action is called Push. The command to push files is
git push
. - Developer A gives Developer B access to his Remote Repository.
- Developer B brings the files from the Remote Repository to her local computer. When she does this for the first time, the action is called Clone. Clone creates the same set of files as the Remote Repository in the local computer — committed files are registered in her Local Repository and the same files are saved under the project directory. The command to clone is
git clone
. - Developer B can work on creating new lines of code and save them under her Local Repository (Commit).
- Developer B pushes them back to Remote Repository where Developer A can access them.
- Developer A can bring the files back to his Local Repository and his project directory. This action is called Pull. The command to pull files is
git pull
.
The flow above is one of the typical cases. We’ll give more details about the Remote Repository in Chapter 6. Remote Collaboration.