Git Regular Workflow – Remote Collaboration

How to Remote Collaboration in Git

The goal of this chapter is to help you fully understand how to collaborate with others through a Remote Repository on GitHub.

There are two aspects you need to learn about remote collaboration:

  1. Key Git Commands on your local computer.
  2. GUI (Graphic User Interface) operations on the GitHub web platform.

1. Key Git commands

In this chapter, we'll cover four key Git commands.

  • git remote: this command is a multi-use command relating to managing a Remote Repository. For example, with the git remote add command, you can establish a link between a Remote Repository and a Local Repository (set up a communication protocol and URL). The git remote -v command shows the status of the link.
  • git push: with this command, you can upload project directories and files along with commit histories for a specified branch from your computer to a Remote Repository
  • git pull: with this command, you can download project directories and files along with commit histories for a specified branch from a Remote Repository. This command also merges the downloaded branch with an existing branch under the Local Repository.
  • git fetch: with this command, you can obtain the latest Remote Repository information and store it on your local computer. This command doesn't enforce the merging of the branches in the Local Repository. If you want to update the Local Repository, you need to run the git merge or git checkout command.

2. GUI operations on the GitHub website

In this chapter, we'll cover two key features of GitHub.

  • Pull request: this feature is used for asking a reviewer to review your edits. It is especially helpful when you want to ask the reviewer to merge your branch (a topic branch) with the main (master) branch.
  • Merge: this feature gives similar functionality as the git merge command and the git rebase command. You can execute merge or rebase operations on the GitHub web platform. There are three merge approaches.
    • Create a merge commit
    • Squash and merge
    • Rebase and merge

You can also learn this topic offline. Click AmazonKindle.