Git Commands Cheat Sheet
Comprehensive Git command reference organized by workflow.
Setup & Config
git config --global user.name "Name"Set global usernamegit config --global user.email "email"Set global emailgit config --listList all config settingsgit initInitialize a new local repositorygit clone <url>Clone a remote repositoryStaging & Committing
git statusShow working tree statusgit add <file>Stage a specific filegit add .Stage all changesgit commit -m "message"Commit staged changes with a messagegit commit --amendModify the last commitgit diffShow unstaged changesgit diff --stagedShow staged changesBranching
git branchList all local branchesgit branch <name>Create a new branchgit checkout <branch>Switch to a branchgit checkout -b <branch>Create and switch to a new branchgit 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 branchgit branch -D <branch>Force-delete a branchgit merge <branch>Merge a branch into current branchgit rebase <branch>Rebase current branch onto anotherRemote Repositories
git remote -vList remote connectionsgit remote add origin <url>Add a remote named origingit fetchDownload remote changes without merginggit pullFetch and merge remote changesgit pull --rebaseFetch and rebase instead of mergegit push origin <branch>Push branch to remotegit push -u origin <branch>Push and set upstream trackinggit push --force-with-leaseSafe force push (checks remote)History & Log
git logShow commit historygit log --oneline --graphCompact branch graphgit log -n 10Show last 10 commitsgit log --author="name"Filter commits by authorgit blame <file>Show who changed each linegit show <commit>Show details of a specific commitUndoing Changes
git restore <file>Discard unstaged changes in a filegit restore --staged <file>Unstage a filegit reset HEAD~1Undo last commit, keep changes stagedgit reset --soft HEAD~1Undo last commit, keep changesgit reset --hard HEAD~1Undo last commit, discard changesgit revert <commit>Create a new commit that undoes a commitgit stashStash uncommitted changesgit stash popApply and remove latest stashgit stash listList all stashesTags
git tagList all tagsgit tag v1.0.0Create a lightweight taggit tag -a v1.0.0 -m "Release"Create an annotated taggit push origin --tagsPush all tags to remotegit tag -d v1.0.0Delete a local tag이 도구 소개
Git 명령어 레퍼런스는 설정, 스테이징, 커밋, 브랜치, 원격 저장소, 로그, 되돌리기, 태그 등 7개 카테고리의 Git 명령어를 빠르게 찾아볼 수 있는 참고 도구입니다.
검색 기능을 사용하면 명령어 이름이나 설명어로 즉시 필터링할 수 있습니다. 북마크해두고 필요할 때마다 참고하세요.
사용 방법
- 검색창에 명령어 이름이나 키워드를 입력하세요 (예: commit, branch, remote).
- 일치하는 명령어가 카테고리별로 즉시 필터링됩니다.
- 명령어와 설명을 확인하세요.
- 검색창을 비우면 전체 목록이 다시 표시됩니다.
활용 사례
개발자들이 자주 쓰는 Git 명령어 문법을 빠르게 확인할 때 사용합니다. Git을 배우는 입문자에게 카테고리별 구조가 도움이 됩니다. 코드 리뷰 중 특정 git 작업 방법을 빠르게 찾을 때 유용합니다.
자주 묻는 질문
- 명령어 설명이 영어인 이유는? — Git 명령어와 플래그는 기술 용어로 국제 표준입니다. 원문 그대로 유지하는 것이 오해를 방지합니다.
- 모든 Git 명령어가 포함되어 있나요? — 자주 사용하는 핵심 명령어를 엄선했습니다. 전체 명령어는 공식 git 문서를 참고하세요.