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 4. Edit & Commit

Chapter 4. Edit & Commit

How to Edit and Commit using Git Commands

Once you launch a project, you can start writing and editing your code. Git allows you to track changes effectively by committing different versions of your code into the Local Repository. In this chapter, we'll cover essential Git commands that are part of the regular workflow for editing and saving files.

What We Cover in This Chapter

The following topics are covered in this chapter:

Git Regular Workflow – Edit & Commit

In this section, we'll explore the fundamental cycle of editing and saving code using Git. You'll learn about key Git commands that help you manage version history efficiently.

Edit and Commit Overview (1)

Git uses a three-stage architecture to track changes. In this section, we’ll provide an overview of how the working tree, staging area, and local repository interact when making commits.

Add Files to Staging Area – git add

The git add command is used to move changes from the working directory to the staging area. In this section, we'll explain how to add specific files, entire directories, or all changes at once.

Commit Files – git commit

Once files are staged, they can be saved in the Local Repository using the git commit command. We’ll cover how to write meaningful commit messages and use different commit options.

HEAD and INDEX

We'll introduce two key Git concepts: HEAD, which refers to the latest commit, and INDEX, also known as the staging area, where changes are prepared before committing.

Check Status of Working Tree and Staging Area – git status

Using the git status command, you can check the state of your working directory and staging area. This helps track which files are modified, staged, or untracked.

Check Commit Histories – git log

The git log command allows you to review previous commits. We'll explore how to use different options to simplify commit history and visualize branch structures.

Check Differences – git diff

We'll examine how the git diff command can be used to compare changes between the working tree, staging area, and commits, helping you review modifications before committing.

Restore Files to Working Tree – git restore

If you need to revert changes in the working directory, git restore can be used to return files to a previous state, whether from the latest commit or a specific commit.

Undo Changes – git reset

The git reset command is useful for undoing changes by resetting the staging area or commit history. We'll discuss different reset options and their impact.

Delete Files – git rm

To remove files from the working directory and the repository, you can use the git rm command. This section explains how to delete files and commit the changes.

Edit and Commit Overview (2)

Before moving to the next chapter on branching, we’ll introduce another diagram that visualizes how Git handles edits and commits, helping you better understand how branches work.

Learn offline for better focus!
A book for this course is available on Amazon.

Git & GitHub Visual Guide

The Hands-On Manual for Complete Beginners to Master Version Control and Remote Coding Collaboration

Your browser does not support the video tag.
Get the Book Now

More Topics to Explore

Overview of Django User Management Functions

Overview of User Management Functions

Managing Static Files in Django Production

Static File Settings

Setting Up SSH Remote Connection for Deployment

Hosting Service Initial Settings (2) – SSH Remote Connection

Generating Personal Access Tokens (PAT)

Generating PAT (Personal Access Token)

Overview of Docker Workflow

Overview of Docker Workflow

Overview of Django User Management Functions

Overview of User Management Functions

Managing Static Files in Django Production

Static File Settings

Setting Up SSH Remote Connection for Deployment

Hosting Service Initial Settings (2) – SSH Remote Connection

Generating Personal Access Tokens (PAT)

Generating PAT (Personal Access Token)

Overview of Docker Workflow

Overview of Docker Workflow

Tags:

Git

GitHub

Commit

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