TL
Tool Lab
💰Donate
💰Donate

Git Commands Cheat Sheet

Comprehensive Git command reference organized by workflow.

Setup & Config

git config --global user.name "Name"Set global username
git config --global user.email "email"Set global email
git config --listList all config settings
git initInitialize a new local repository
git clone <url>Clone a remote repository

Staging & Committing

git statusShow working tree status
git add <file>Stage a specific file
git add .Stage all changes
git commit -m "message"Commit staged changes with a message
git commit --amendModify the last commit
git diffShow unstaged changes
git diff --stagedShow staged changes

Branching

git branchList all local branches
git branch <name>Create a new branch
git checkout <branch>Switch to a branch
git checkout -b <branch>Create and switch to a new branch
git switch <branch>Switch to a branch (modern)
git switch -c <branch>Create and switch to a new branch (modern)
git branch -d <branch>Delete a merged branch
git branch -D <branch>Force-delete a branch
git merge <branch>Merge a branch into current branch
git rebase <branch>Rebase current branch onto another

Remote Repositories

git remote -vList remote connections
git remote add origin <url>Add a remote named origin
git fetchDownload remote changes without merging
git pullFetch and merge remote changes
git pull --rebaseFetch and rebase instead of merge
git push origin <branch>Push branch to remote
git push -u origin <branch>Push and set upstream tracking
git push --force-with-leaseSafe force push (checks remote)

History & Log

git logShow commit history
git log --oneline --graphCompact branch graph
git log -n 10Show last 10 commits
git log --author="name"Filter commits by author
git blame <file>Show who changed each line
git show <commit>Show details of a specific commit

Undoing Changes

git restore <file>Discard unstaged changes in a file
git restore --staged <file>Unstage a file
git reset HEAD~1Undo last commit, keep changes staged
git reset --soft HEAD~1Undo last commit, keep changes
git reset --hard HEAD~1Undo last commit, discard changes
git revert <commit>Create a new commit that undoes a commit
git stashStash uncommitted changes
git stash popApply and remove latest stash
git stash listList all stashes

Tags

git tagList all tags
git tag v1.0.0Create a lightweight tag
git tag -a v1.0.0 -m "Release"Create an annotated tag
git push origin --tagsPush all tags to remote
git tag -d v1.0.0Delete a local tag

Over deze tool

De Git Commando Referentie biedt een snel opzoekindex van essentiële Git-commando's in zeven categorieën: instelling, staging & commits, branching, remotes, geschiedenis, wijzigingen ongedaan maken en tags.

Gebruik het zoekvak om direct te filteren op commando-naam of beschrijving. Sla deze pagina op als bladwijzer en kom terug wanneer u een snelle syntaxherinnering nodig heeft.

Hoe te gebruiken

  1. Typ een commando-naam of sleutelwoord in het zoekvak (bijv. commit, branch, remote).
  2. Overeenkomende commando's worden in realtime per categorie gefilterd.
  3. Bekijk het commando en de beschrijving.
  4. Leeg het zoekvak om de volledige lijst te herstellen.

Gebruiksscenario's

Ontwikkelaars gebruiken het om snel de syntaxis van Git-commando's te herinneren zonder de browser te verlaten. Beginners profiteren van de categoriestructuur bij het leren van Git. Handig tijdens code reviews om snel een specifieke git-operatie op te zoeken.

Veelgestelde vragen

  • Waarom zijn de beschrijvingen van commando's in het Engels?Git-commando's en flags zijn internationale technische standaarden. Ze in het Engels houden voorkomt verkeerde vertaling van technische termen.
  • Bevat het alle Git-commando's?Het behandelt de meest gebruikte commando's. Raadpleeg de officiële git-documentatie voor de volledige referentie.