Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

Git & GitHub IntroductionChapter 6. Remote Collaboration

Remote Collaboration Overview

Remote Collaboration Overview

Overview of Remote Collaboration with Git and GitHub

In a typical remote collaboration, you need to seamlessly work on both your local computer (i.e., the command line and a text editor) and a Remote Repository on the GitHub website.

The following is one of the typical flows of remote collaboration on Git & GitHub.

A typical cycle of remote collaboration

  1. Developer A (a project leader and the owner of the Remote Repository) establishes a link between his Local Repository and the Remote Repository used for the project. To establish the connection, he runs the git remote command.
  2. Once Developer A's Local Repository is linked with the Remote Repository, he can push his project directory to the Remote Repository by running the git push command. He also gives Developer B access to the repository at this point.
  3. After Developer B obtains access to the Remote Repository, she can bring the project directory from the repository by running the git clone command. The git clone command establishes a link between the Remote Repository and her Local Repository, and the command also creates a copy of the project directory on her local computer.
  4. There are two approaches for getting the project files from the Remote Repository the second time:
    • Running the git pull command
    • Running the git fetch command followed by the git merge command.

Note: The git pull command works as the git fetch command and git merge command. The git pull command is useful to save time, however, there are some cases when you need to run the git fetch command. This will be explained later.

  1. Once Developer B obtains the project directory under the master branch, she is ready to make her edits (e.g., adding a new feature of the program). To start her editing, she creates a new branch (topic branch) to separate her work from the main line of code development. After that, she edits the code on the new branch and creates a commit when her work is done.
  2. To share the edited code under the topic branch, Developer B pushes the branch into the Remote Repository by running the git push command.
  3. At this stage, the code edited by Developer B is not integrated into the master branch yet. Before integrating it, she asks Developer A to review the code and merge it with the master branch through a pull request. A pull request is a form on GitHub to create a request for a reviewer to review code and merge it with the main branch (e.g., the master branch).
  4. Once Developer A receives a pull request, he reviews the code and decides if the new code is ready to merge or still requires further edits. If further edits are required, he gives Developer B feedback on her code.
  5. If the code developed by Developer B is ready to merge, Developer A merges the topic branch with the master branch on the GitHub website.

Practice

Objective:
Prepare for practices

This section gives you information about how to prepare for practice in this chapter. The actual practice will start from the next page.

1. Accounts used in the practice explanation

As explained earlier, to fully understand the remote collaboration approach with Git and GitHub, you need to understand at least two different user perspectives:

1. The owner of the Remote Repository (Developer A)

2. A collaborator of the Remote Repository (Developer B)

The roles and account information details are described in the illustration below.

Git and GitHub practice role examples

If there are two roles in the practice section on the same page, we'll use the following boxes to make it clear from which perspective the section is being explained.

bloovee-round-icon.pngAction by Developer A

Developer A's actions are described here

skyblue-round-icon.pngAction by Developer B

Developer B's actions are described here

2. Commit history rules for this practice

For practice purposes, we set a rule for commit messages so that you can easily follow what each commit is about.

Example

commit message "M2LB"

M – Branch (e.g., M is Master, A is Branch_A)

2 – Commit order (e.g., 2 is the second commit on the branch)

L – Local vs. Remote (L is committed in the Local Repository, R is committed in the Remote Repository)

B – Developer who made the commit (e.g., A is Developer A, B is Developer B)

We also put the same letters as the content of practice files that are committed so you can easily see the relations between the commit and the edited content.

Note: This approach is only for practice purposes. In actual projects, you need to use a concise description of the key changes in the code (e.g., "fixed landing page UI", "integrated APIs", etc.).


You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Understanding Django's Built-in User Model

User Models

Collaborating Remotely with Git and GitHub

Chapter 6. Remote Collaboration

Configuring Nginx as a Web Server for Django

Web Server Setup – Nginx

How to Install Python for Django Development

Install Python

Implementing Choices in Django Model Fields

Django Models – Choices Option

Understanding Django's Built-in User Model

User Models

Collaborating Remotely with Git and GitHub

Chapter 6. Remote Collaboration

Configuring Nginx as a Web Server for Django

Web Server Setup – Nginx

How to Install Python for Django Development

Install Python

Implementing Choices in Django Model Fields

Django Models – Choices Option

Tags:

Remote Repository

Fetch

Git & GitHub Introduction
Course Content

Chapter 1. Git & GitHub Overview

What Is Git?

What Is Version Control?

How To Save Versions in Git?

Collaborating on Git & GitHub – Remote Repository

Collaborating on Git & Git Hub – Branch

Git & GitHub Basic Life Cycle

Chapter 2. Git & GitHub Initial Settings

Git & GitHub Initial Settings Overview

Key Tool Preparation (1) – Mac

Key Tool Preparation (2) – Windows

Key Tool Preparation (3) – Linux Remote Server

Git User Settings – git config

Create GitHub Account

GitHub Access Authentication Settings

Generating PAT (Personal Access Token)

GitHub SSH Setup

Chapter 3. Git & GitHub Project Setup

Three Cases in Git & GitHub Project Setup

Git & GitHub Project Setup Overview in Different Cases

Building Remote Collaboration Practice Environment

Project Initiator – Key Steps To Launch Git Project

Project Initiator – Create Local Repository (git init)

Project Initiator – Make the First Commit

Project Initiator – .gitignore File

Project Initiator – Create Remote Repository

Project Initiator – Link Between Remote and Local Repositories (git remote add)

Project Initiator – Upload Local Repository to Remote Repository (git push)

Project Initiator – Grant Remote Repository Access to Project Members

Project Member – Start Project As Collaborator

Project Member – Create Copy of Project Code on Local Computer (git clone)

Non-Member – Start Project With Replica of Existing Repository (Fork)

Fork vs. Clone

Chapter 4. Edit & Commit

Git Regular Workflow – Edit & Commit

Edit and Commit Overview (1)

Add Files to Staging Area – git add

Commit Files – git commit

HEAD and INDEX

Check Status of Working Tree and Staging Area – git status

Check Commit Histories – git log

Check Differences – git diff

Restore Files to Working Tree – git restore

Undo Changes – git reset

Delete Files – git rm

Edit and Commit Overview (2)

Chapter 5. Work With Branches

Git Regular Workflow – Work With Branches

What Is Branch?

Branch Operation Basic Life Cycle

Create Branch and Check Branch Status – Git Branch

Switch Current Branch (1) – Git Checkout

Switch Current Branch (2) – Git Switch

Merge Branches – Git Merge

Fast-Forward Merge

Non-Fast-Forward Merge (No Option)

Non-Fast-Forward Merge (--no-ff Option)

Squash Merge

Rebase Branch – Git Rebase

Managing Conflict

Stash Changes – Git Stash

Chapter 6. Remote Collaboration

Git Regular Workflow – Remote Collaboration

Remote Collaboration Overview

Link With Remote Repository – Git Remote

Upload to Remote Repository – Git Push

Download Remote Repository and Merge to Local Repository – Git Pull

Get Remote Repository Information to Local Repository – Git Fetch

Pull vs. Fetch

Request for Review and Merge – Pull Request

Merge Operation Using GitHub

Chapter 7. Supplemental Topics

Git Key Commands and GitHub Key Features

Git & GitHub Glossary

GitHub Other Features

Chapter 1. Git & GitHub Overview

What Is Git?

What Is Version Control?

How To Save Versions in Git?

Collaborating on Git & GitHub – Remote Repository

Collaborating on Git & Git Hub – Branch

Git & GitHub Basic Life Cycle

Chapter 2. Git & GitHub Initial Settings

Git & GitHub Initial Settings Overview

Key Tool Preparation (1) – Mac

Key Tool Preparation (2) – Windows

Key Tool Preparation (3) – Linux Remote Server

Git User Settings – git config

Create GitHub Account

GitHub Access Authentication Settings

Generating PAT (Personal Access Token)

GitHub SSH Setup

Chapter 3. Git & GitHub Project Setup

Three Cases in Git & GitHub Project Setup

Git & GitHub Project Setup Overview in Different Cases

Building Remote Collaboration Practice Environment

Project Initiator – Key Steps To Launch Git Project

Project Initiator – Create Local Repository (git init)

Project Initiator – Make the First Commit

Project Initiator – .gitignore File

Project Initiator – Create Remote Repository

Project Initiator – Link Between Remote and Local Repositories (git remote add)

Project Initiator – Upload Local Repository to Remote Repository (git push)

Project Initiator – Grant Remote Repository Access to Project Members

Project Member – Start Project As Collaborator

Project Member – Create Copy of Project Code on Local Computer (git clone)

Non-Member – Start Project With Replica of Existing Repository (Fork)

Fork vs. Clone

Chapter 4. Edit & Commit

Git Regular Workflow – Edit & Commit

Edit and Commit Overview (1)

Add Files to Staging Area – git add

Commit Files – git commit

HEAD and INDEX

Check Status of Working Tree and Staging Area – git status

Check Commit Histories – git log

Check Differences – git diff

Restore Files to Working Tree – git restore

Undo Changes – git reset

Delete Files – git rm

Edit and Commit Overview (2)

Chapter 5. Work With Branches

Git Regular Workflow – Work With Branches

What Is Branch?

Branch Operation Basic Life Cycle

Create Branch and Check Branch Status – Git Branch

Switch Current Branch (1) – Git Checkout

Switch Current Branch (2) – Git Switch

Merge Branches – Git Merge

Fast-Forward Merge

Non-Fast-Forward Merge (No Option)

Non-Fast-Forward Merge (--no-ff Option)

Squash Merge

Rebase Branch – Git Rebase

Managing Conflict

Stash Changes – Git Stash

Chapter 6. Remote Collaboration

Git Regular Workflow – Remote Collaboration

Remote Collaboration Overview

Link With Remote Repository – Git Remote

Upload to Remote Repository – Git Push

Download Remote Repository and Merge to Local Repository – Git Pull

Get Remote Repository Information to Local Repository – Git Fetch

Pull vs. Fetch

Request for Review and Merge – Pull Request

Merge Operation Using GitHub

Chapter 7. Supplemental Topics

Git Key Commands and GitHub Key Features

Git & GitHub Glossary

GitHub Other Features