Git

What is Git?

Git is a distributed version control system (DVCS) used to:

  • track changes to files over time
  • collaborate with multiple people on the same project
  • manage branches independently
  • sync code with GitHub or other remotes

Core features

  • Version tracking: every change is recorded and can be reviewed later.
  • Team collaboration: people can work in parallel on the same project.
  • Branch management: separate work streams are created and merged later.
  • Remote synchronization: the project can be pushed to GitHub for sharing.

Install Git

  1. Download Git from git-scm.com

    • macOS: brew install git
    • Linux: sudo apt update && sudo apt install git
  2. Check installation

git --version
  1. Configure your identity
git config --global user.name "your name"
git config --global user.email "your email"
git config --list

GitHub integration

  1. Register on GitHub
  2. Create a repository
  3. Generate an SSH key and add it to GitHub
ssh-keygen -t ed25519 -C "your-email"
cat ~/.ssh/id_ed25519.pub
ssh -T git@github.com

To link a local project to a remote repository:

git remote add origin "your-remote-url"

Basic workflow

clone → branch → edit → add → commit → push → PR

Clone a repository

git clone <ssh-or-https-url>

Check status

git status
git branch

Create a branch

git switch -c feature/update-thing

Stage changes

git add .
git add -p

Commit changes

git commit -m "update message"

Push to remote

git push -u origin <branch-name>

Branch strategy

A branch is an independent line of work. It allows multiple developers to work without interfering with one another.

TaskCommand
List branchesgit branch
Create branchgit switch -c feature/login
Switch branchgit switch main
Merge branchgit merge feature/login
Rebase branchgit rebase main
Delete branchgit branch -d feature/login

Summary

Git is the standard tool for version control in software development. It makes collaboration safer, improves traceability, and gives teams a clear way to manage change.

Related articles

Introduction to Linux

An operating system sits between users and hardware. It manages memory, processes, files, and devices while exposing a graphical or command-line interface. - Linux - iOS - Android - macOS - Windows…

Training

Poetry

This file defines project metadata and dependencies. This file pins the exact dependency versions used in the project for reproducibility. --- --- Poetry is ideal for clean, reproducible Python pro…

Training

Python

In Python, values such as integers, strings, lists, and functions are all objects. They have types and methods, which is different from C++ primitive values. --- Lists are ordered, mutable sequence…

Training

Advanced Packaging Tool

This document contains frequently used command and the corresponding used cases for package management software Advanced Packaging Tool (APT). For simplification, all the variables are written in p…

Training