LoongLee's blog

Git Guide

=== Understanding Git Commands, Mastering Version Control


Git, the essential version control tool. Linus Benedict Torvalds, the legendary programmer and creator of the Linux kernel, invented this famous version control system.

git init

The first thing to do when creating a new project. Creates a .git repository (hidden folder) in the project directory. A repository is a collection of all changes to your project files stored in chronological order.

git config

$:git config --global user.name "Your name"
$:git config --global user.email "YourEmail@xxx.com"
Used to set your commit information. Only needs to be configured once after Git installation.

git add filename

Adds any file you want to the staging area.

git add .

Adds all files in the project folder to the staging area without adding them one by one.

git status

Shows all files you've placed in the staging area and files that have been modified and need to be staged.

git reset filename

Removes the specified file from the staging area.

git rm --cached filename

Removes the specified file from the staging area and sets it to untracked.

git commit -m "Description of the commit"

Takes files from the staging area and commits them to the local repository. The quoted part is a description of the modified files. Make sure to keep it simple and clear, never omit it.

IT Tech, Git