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 7. Supplemental Topics

Git Key Commands and GitHub Key Features

Git Key Commands and GitHub Key Features

Key Git Commands and GitHub Features Cheat Sheet

This page summarizes the key Git commands and key GitHub features covered in this course. You can use this page as a cheat sheet.

Chapter 2. Git & GitHub Initial Settings

$ git config: a command used when you register (or change) key user settings in the Git system. For example, you can do the following with this command

  • Register your username and email address
  • Register a text editor
  • Check configured settings
  • Clear configured settings

Chapter 3. Git & GitHub Project Setup

$ git init: a command used for initiating a Git project by creating a new Local Repository in the current directory.

$ git clone: a command used to create a link to a Remote Repository and bring the project directory from the Remote Repository with commit histories to your local computer. This command is used only the first time you bring the project directory to your local computer. The git clone command establishes a connection between the Remote Repository and your local computer by registering on your computer the URL that defines the location of the Remote Repository. Once the connection is established, you can Pull or Fetch the Remote Repository.

Fork: a feature provided by GitHub and used to create a replica of a Remote Repository on GitHub. After implementing Fork, the replicated repository will be separated from the original repository. You can modify codes in the replicated repository on your own without permission from the owners of the original repository (within the software license agreement, if any). Fork is not a git command. It is executed on the GitHub website. Go to the GitHub site and find the repository which you want to create a replica of. There is a Fork button on the Remote Repository page. Press the Fork button to implement Fork.

Chapter 4. Edit & Commit

$ git add: with this command, you can add files to the Staging Area (INDEX), where you can prepare and check files before registering in your Local Repository.

$ git status: with this command, you can see the status of the Working Tree (working directory) and the Staging Area (INDEX). This status lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git.

$ git commit: with this command, you can register files in your Local Repository. Once the files are registered, you can retrieve the saved version of the set of files at any time.

$ git log: with this command, you can check the information on the commit history of the repository

$ git diff: with this command, you can check differences between the Working Tree, Staging Area (INDEX), and commit histories.

$ git restore: with this command, you can bring your Working Tree back to the latest commit or a specific commit. This command is useful when you want to clear your edits and go back to a cleaner version.

$ git rm: with this command, you can delete files or directories under the Working Tree and the Staging Area (INDEX). When you want to reflect the deleted status as a formal version, you need to create another commit.

$ git reset: with this command, you can reset the Staging Area (INDEX) or change commit histories with or without changing the contents of your local files.

Chapter 5. Work With Branches

$ git branch: this command is a multi-use command. For example, it is used for creating a new branch, checking branch status, and deleting an unused branch.

$ git checkout: with this command, you can switch your current branch to a selected branch.

$ git switch: with this command, you can get the same result as that of git checkout. It is a command newly introduced as a substitute for the git checkout command.

$ git merge: with this command, you can merge branches. The merge operation can be done through a Remote Repository on the GitHub website.

$ git rebase: with this command, you can reapply commits on top of another base branch. This command is useful when you want to streamline commits that diverged into multiple branches. The rebase operation can also be done through a Remote Repository on the GitHub website. It is an option of the merge feature of GitHub.

$ git stash: with this command, you can separately manage WIP (Work In Progress) codes. When you want to switch the current branch in the middle of editing the Working Tree, the edits can prevent you from switching the current branch. In that case, this command is useful. The stashed lines of code are parked somewhere temporarily.

Chapter 6. Remote Collaboration

$ 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. 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 merging branches in the Local Repository. If you want to update the Local Repository, you need to run the git merge or git checkout command.

Pull request: this feature is used to ask a reviewer to review your edits. It is especially useful when you want to ask the reviewer to merge your branch (a topic branch) with the main branch (e.g., 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 website. There are three merge approaches. 1) Create a merge commit, 2) Squash and merge, 3) Rebase and merge.


You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Simplifying SSH with SSH Config File

SSH Config File

Git & GitHub Initial Settings Overview

Git & GitHub Initial Settings Overview

Git's Edit and Commit Overview

Edit and Commit Overview (1)

Chapter 2. Getting Started with Docker

Chapter 2. Getting Started with Docker

Managing Local and Remote Environments in Django

Manage Local Development and Remote Production Environment

Simplifying SSH with SSH Config File

SSH Config File

Git & GitHub Initial Settings Overview

Git & GitHub Initial Settings Overview

Git's Edit and Commit Overview

Edit and Commit Overview (1)

Chapter 2. Getting Started with Docker

Chapter 2. Getting Started with Docker

Managing Local and Remote Environments in Django

Manage Local Development and Remote Production Environment

Tags:

Git

GitHub

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