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 --listList all configuration settings
초기화
git initInitialize a new local repository
git clone <url>Clone a remote repository
git clone <url> <dir>Clone into a specific directory
스테이징 & 스냅샷
git statusShow working tree status
git add <file>Stage a specific file
git add .Stage all changes
git add -pInteractively stage hunks
git diffShow unstaged changes
git diff --stagedShow staged changes
git commit -m "message"Commit staged changes
git commit -am "message"Stage tracked files and commit
git commit --amendAmend the last commit
브랜치 & 병합
git branchList 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 -vList remotes
git remote add origin <url>Add a remote
git fetchFetch all remotes
git pullFetch and merge from remote
git pull --rebaseFetch 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-leaseSafe force push
되돌리기 & 리셋
git revert <commit>Create revert commit
git reset HEAD <file>Unstage a file
git reset --soft HEAD~1Undo last commit, keep staged
git reset --hard HEAD~1Undo last commit, discard changes
git checkout -- <file>Discard file changes
git clean -fdRemove untracked files/dirs
스태시
git stashStash working directory changes
git stash listList all stashes
git stash popApply latest stash and remove
git stash apply stash@{n}Apply specific stash
git stash drop stash@{n}Delete a stash
로그 & 조회
git log --onelineCompact commit history
git log --oneline --graph --allVisual 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
명령어나 설명으로 검색하세요.
- 2
섹션별 git 명령을 둘러보세요.
- 3
항목을 클릭하면 명령이 복사됩니다.
FAQ
이 도구는 무료인가요?
네, 가입 없이, 설치 할 필요도 없이 완전 무료로 바로 사용할 수 있습니다.
이 도구는 어떤 도구인가요?
필수 Git 명령어 빠른 참조. 카테고리별로 정리되어 있으며 검색 및 클릭으로 복사 기능을 지원합니다. 회원가입이나 설치 없이, 페이지만 열면 바로 무료로 사용할 수 있어요.