Core Installation
2. Git
Install and configure Git for use with Claude Code. Complete setup for code versioning with AI assistants.
2 min read
Claude Code uses Git extensively: it reads history, makes commits, creates branches, and resolves conflicts.
Add the official Git PPA
sudo add-apt-repository ppa:git-core/ppa -yUpdate package index
sudo apt updateInstall updated Git
sudo apt install -y gitCheck version
git --version
# Expected: git version 2.47+Minimal configuration
Set your name
git config --global user.name "Your Name"Set your email
git config --global user.email "your@email.com"Default branch
git config --global init.defaultBranch mainCheck configuration
Check name
git config --global user.nameCheck email
git config --global user.emailCheck default branch
git config --global init.defaultBranchUseful commands
View repository status
git statusCommit list (titles only)
git log --onelineFull commit list (with details)
git logRevert to the last commit (discard everything)
git reset --hard HEAD && git clean -fd
# Discards changes and removes untracked filesRevert to a specific commit
git reset --hard <commit-hash> && git clean -fd
# Replace <commit-hash> with the hash obtained via git log