Référence développeur
Stop Googling. Commencer shipping.
15+ cheat sheets for Git, VS Code, Vim, Regex, CSS, JavaScript, Python, SQL, Docker, and more. Searchable. Copy-friendly.
Git Commands
Setup & Init
git initInitialize a new repository
e.g. git init my-project
git clone <url>Clone a remote repository
e.g. git clone https://github.com/user/repo.git
git config --global user.nameSet global username
e.g. git config --global user.name "John"
Basic Workflow
git statusShow working tree status
git add <file>Stage changes
e.g. git add . (stage all)
git commit -mCommit staged changes
e.g. git commit -m "feat: add login"
git pushPush to remote
e.g. git push origin main
git pullFetch + merge from remote
git fetchDownload remote changes without merging
Branching
git branchList branches
git branch <name>Create a new branch
git checkout <branch>Switch branches
git checkout -b <name>Create & switch to new branch
git merge <branch>Merge branch into current
git rebase <branch>Rebase current onto branch
git branch -d <name>Delete a branch
Undoing Things
git reset HEAD <file>Unstage a file
git checkout -- <file>Discard file changes
git revert <commit>Create a new commit that undoes changes
git stashTemporarily store modified files
git stash popRestore stashed changes
History & Diff
git log --onelineCompact commit history
git diffShow unstaged changes
git diff --stagedShow staged changes
git blame <file>Show who changed each line