TL
툴랩
💰후원하기
💰후원하기

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

이 도구 소개

Git 명령어 레퍼런스는 설정, 스테이징, 커밋, 브랜치, 원격 저장소, 로그, 되돌리기, 태그 등 7개 카테고리의 Git 명령어를 빠르게 찾아볼 수 있는 참고 도구입니다.

검색 기능을 사용하면 명령어 이름이나 설명어로 즉시 필터링할 수 있습니다. 북마크해두고 필요할 때마다 참고하세요.

사용 방법

  1. 검색창에 명령어 이름이나 키워드를 입력하세요 (예: commit, branch, remote).
  2. 일치하는 명령어가 카테고리별로 즉시 필터링됩니다.
  3. 명령어와 설명을 확인하세요.
  4. 검색창을 비우면 전체 목록이 다시 표시됩니다.

활용 사례

개발자들이 자주 쓰는 Git 명령어 문법을 빠르게 확인할 때 사용합니다. Git을 배우는 입문자에게 카테고리별 구조가 도움이 됩니다. 코드 리뷰 중 특정 git 작업 방법을 빠르게 찾을 때 유용합니다.

자주 묻는 질문

  • 명령어 설명이 영어인 이유는?Git 명령어와 플래그는 기술 용어로 국제 표준입니다. 원문 그대로 유지하는 것이 오해를 방지합니다.
  • 모든 Git 명령어가 포함되어 있나요?자주 사용하는 핵심 명령어를 엄선했습니다. 전체 명령어는 공식 git 문서를 참고하세요.