~/CloudSetup.In

Git

Version Control .gitconfig ● stable

Distributed version control for tracking and collaborating on source code.

01 Overview

Git tracks every change to a codebase as a graph of commits, letting teams branch, merge, and review work in parallel without stepping on each other. It underpins virtually every CI/CD and GitOps workflow.

→ official documentation

02 Installation

Pick a platform. Each step is copy-pasteable on its own.

01  Update package index
sudo apt update
02  Install Git
sudo apt install -y git
03  Set your identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
04  Verify
git --version
01  Install Git
sudo dnf install -y git
02  Set your identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
03  Verify
git --version
01  Install via Homebrew
brew install git
02  Set your identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
03  Verify
git --version
Note — commands assume sudo privileges and an up-to-date package index. Pin a specific version in production rather than tracking latest.

03 Install script

The steps above bundled into a single idempotent shell script for provisioning boxes unattended.

install-git.sh
Ubuntu/Debian target · safe to re-run · exits non-zero on failure
↓ download script

04 Cheatsheet

The commands reached for most often once Git is installed.

CommandWhat it does
git statusShow changed and staged files
git switch -c feature/xCreate and switch to a new branch
git add -pInteractively stage hunks
git commit -m "message"Commit staged changes
git rebase -i HEAD~5Interactively edit the last 5 commits
git stash / git stash popShelve and restore uncommitted work
git log --oneline --graph --allCompact visual history of all branches
git bisect startBinary-search commits for a regression