Git

Version Control
Repository
git init Initialize new repository Win mac Linux
git clone <url> Clone a remote repository Win mac Linux
git status Show working tree status Win mac Linux
git log --oneline Compact commit history Win mac Linux
git log --graph Visual branch history Win mac Linux
Staging & Commits
git add . Stage all changes Win mac Linux
git add <file> Stage specific file Win mac Linux
git commit -m "msg" Commit with message Win mac Linux
git commit --amend Amend last commit Win mac Linux
git diff Show unstaged changes Win mac Linux
git diff --staged Show staged changes Win mac Linux
git reset HEAD <file> Unstage a file Win mac Linux
Branching
git branch List all branches Win mac Linux
git checkout -b <name> Create and switch to new branch Win mac Linux
git switch <branch> Switch to existing branch Win mac Linux
git merge <branch> Merge branch into current Win mac Linux
git rebase <branch> Rebase current branch onto target Win mac Linux
git branch -d <name> Delete branch Win mac Linux
Remote
git push Push commits to remote Win mac Linux
git pull Fetch and merge from remote Win mac Linux
git fetch Fetch changes without merging Win mac Linux
git remote -v List remote connections Win mac Linux
git push -u origin <branch> Push and set upstream tracking Win mac Linux