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

Check Commit Histories – git log

Check Commit Histories – git log

Viewing Commit Histories with git log

git log is the command used when you want to get the commit history information of the repository.

Key information that the git log command provides

For example, when you run this command...

git log

...you'll see a message like the one below. In this case, you can see that there are two commits.

commit acc4aa4c31b033bc39113073ef404e14a970e65b (HEAD -> master, origin/master)
Author: bloovee <bloovee2021@gmail.com>
Date:   Sat Oct 28 11:23:58 2023 +0800

    added .gitignore file

commit 651e510f668aa841a49793b4fa18d2de74c41f5c
Author: bloovee <bloovee2021@gmail.com>
Date:   Sat Oct 28 11:03:27 2023 +0800

    the first commit

For each commit, there are four lines of information.

  1. The first line is commit hash. The commit hash is a unique ID of each commit. When you want to retrieve a commit, you need this hash.
  2. The second line is the username and email address of the author of the commit.
  3. The third line is the date and time of the commit.
  4. The last line is the commit message.

Key options

"--oneline" option

Displays each commit in one line. If commit histories become too long, you may want to skip some items to display. The --oneline option is useful for shortening the descriptions. With this option, each commit history is shown with one line.

When you run the command below...

git log --oneline

You'll see the command line response as shown below.

acc4aa4 (HEAD -> master, origin/master) added .gitignore file
651e510 the first commit

"--graph" option

Displays commits with a graph. With the --graph option, you can see the branch diversion or integration history visually. It is effective when commit histories are more complicated with multiple branches. The branch concept will be explained in the next chapter. The following is an example of running git log with the --graph and --oneline option.

When you run the command below...

git log --oneline --graph

...and when there are multiple branches, you'll see the commit history in a tree structure.

*   b5105dc (HEAD -> master) Merged branch A
|\  
| *   8fef9f1 (Branch_A) Merged branch B
| |\  
| | * 3ab0477 (Branch_B) Edit 5 on branch B
| |/  
| * e83087e Edit 4 on branch A
| * 8fcc58c Edit 3 on branch A
* | a815b57 Edit 2 on master branch
* | 931aef2 Edit 1 on master branch
|/  
* 5c1fd7a First Commit

IdeaTips: Exit from the git log display mode

When you run the git log command, the command line switches to a different display mode in which you cannot type. To go back to the original mode, you need to press the q key.


You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Dockerfile Syntax

Dockerfile Syntax

Django Templates vs. Django APIs for Web Development

Django Templates vs. Django APIs

Key Steps for Deploying a Django App

Key Steps of Django App Deployment

Managing Static Files in Django with {% static %}

Static Files in Development Environment – {% static %} tag

Understanding the Difference Between Django Projects and Apps

Project vs. App

Dockerfile Syntax

Dockerfile Syntax

Django Templates vs. Django APIs for Web Development

Django Templates vs. Django APIs

Key Steps for Deploying a Django App

Key Steps of Django App Deployment

Managing Static Files in Django with {% static %}

Static Files in Development Environment – {% static %} tag

Understanding the Difference Between Django Projects and Apps

Project vs. App

Tags:

Git Key Commands

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