ToolBoxy
💻

Git Cheat Sheet

git · reference · commands

설정

git config --global user.name "Name"

Set your global username

복사
git config --global user.email "email"

Set your global email

복사
git config --global core.editor "code --wait"

Set VS Code as default editor

복사
git config --list

List all configuration settings

복사

초기화

git init

Initialize a new local repository

복사
git clone <url>

Clone a remote repository

복사
git clone <url> <dir>

Clone into a specific directory

복사

스테이징 & 스냅샷

git status

Show working tree status

복사
git add <file>

Stage a specific file

복사
git add .

Stage all changes

복사
git add -p

Interactively stage hunks

복사
git diff

Show unstaged changes

복사
git diff --staged

Show staged changes

복사
git commit -m "message"

Commit staged changes

복사
git commit -am "message"

Stage tracked files and commit

복사
git commit --amend

Amend the last commit

복사

브랜치 & 병합

git branch

List local branches

복사
git branch <name>

Create a new branch

복사
git checkout <branch>

Switch to a branch

복사
git checkout -b <branch>

Create and switch to new branch

복사
git switch <branch>

Switch branches (modern syntax)

복사
git switch -c <branch>

Create and switch (modern)

복사
git merge <branch>

Merge branch into current

복사
git branch -d <branch>

Delete a branch

복사
git branch -D <branch>

Force delete a branch

복사

원격

git remote -v

List remotes

복사
git remote add origin <url>

Add a remote

복사
git fetch

Fetch all remotes

복사
git pull

Fetch and merge from remote

복사
git pull --rebase

Fetch and rebase from remote

복사
git push origin <branch>

Push branch to remote

복사
git push -u origin <branch>

Push and set upstream

복사
git push --force-with-lease

Safe force push

복사

되돌리기 & 리셋

git revert <commit>

Create revert commit

복사
git reset HEAD <file>

Unstage a file

복사
git reset --soft HEAD~1

Undo last commit, keep staged

복사
git reset --hard HEAD~1

Undo last commit, discard changes

복사
git checkout -- <file>

Discard file changes

복사
git clean -fd

Remove untracked files/dirs

복사

스태시

git stash

Stash working directory changes

복사
git stash list

List all stashes

복사
git stash pop

Apply latest stash and remove

복사
git stash apply stash@{n}

Apply specific stash

복사
git stash drop stash@{n}

Delete a stash

복사

로그 & 조회

git log --oneline

Compact commit history

복사
git log --oneline --graph --all

Visual branch graph

복사
git log --author="Name"

Filter commits by author

복사
git show <commit>

Show commit details

복사
git blame <file>

Show who changed each line

복사
git diff <branch1>..<branch2>

Diff between branches

복사

사용 방법

  1. 1

    명령어나 설명으로 검색하세요.

  2. 2

    섹션별 git 명령을 둘러보세요.

  3. 3

    항목을 클릭하면 명령이 복사됩니다.

FAQ

이 도구는 무료인가요?

네, 가입 없이, 설치 할 필요도 없이 완전 무료로 바로 사용할 수 있습니다.

이 도구는 어떤 도구인가요?

필수 Git 명령어 빠른 참조. 카테고리별로 정리되어 있으며 검색 및 클릭으로 복사 기능을 지원합니다. 회원가입이나 설치 없이, 페이지만 열면 바로 무료로 사용할 수 있어요.