Gitチートシート
설정
git config --global user.name "이름"사용자 이름 설정
git config --global user.name "Sam"
git config --global user.email "이메일"이메일 설정
git config --global user.email "sam@example.com"
git config --list모든 설정 확인
git config --list
시작
git init새 저장소 초기화
git init my-project
git clone <url>원격 저장소 복제
git clone https://github.com/user/repo.git
변경 사항
git status작업 디렉토리 상태
git status
git diff변경 사항 비교
git diff HEAD~1
git add <file>스테이징에 추가
git add . / git add file.txt
git commit -m "메시지"커밋 생성
git commit -m "feat: 새 기능"
git commit --amend마지막 커밋 수정
git commit --amend -m "수정된 메시지"
git stash변경 사항 임시 저장
git stash / git stash pop
브랜치
git branch브랜치 목록
git branch -a
git branch <name>새 브랜치 생성
git branch feature/login
git checkout <branch>브랜치 전환
git checkout main
git checkout -b <name>생성 + 전환
git checkout -b feature/login
git merge <branch>브랜치 병합
git merge feature/login
git branch -d <name>브랜치 삭제
git branch -d feature/login
git branch -D <name>브랜치 강제 삭제
git branch -D feature/login
원격
git remote -v원격 저장소 목록
git remote -v
git fetch원격 변경 가져오기
git fetch origin
git pull가져오기 + 병합
git pull origin main
git push원격에 전송
git push origin main
git push --force강제 푸시
git push --force origin main
되돌리기
git restore <file>파일 변경 취소
git restore file.txt
git reset HEAD <file>스테이징 취소
git reset HEAD file.txt
git revert <commit>커밋 되돌리기 (새 커밋)
git revert abc123
git reset --soft HEAD~1마지막 커밋 취소 (변경 유지)
git reset --soft HEAD~1
git reset --hard HEAD~1마지막 커밋 삭제 (변경 삭제)
git reset --hard HEAD~1
조회
git log커밋 이력
git log --oneline --graph
git log --oneline한줄 이력
git log --oneline -10
git show <commit>커밋 상세
git show abc123
git blame <file>줄별 작성자
git blame file.txt
git reflogHEAD 이력 (복구용)
git reflog
Gitチートシートとは?
カテゴリ別に整理されたGitコマンドチートシート。危険度レベル表示付き。
使い方
- 1 カテゴリを選択 — 設定、ブランチ、元に戻すなど、希望のカテゴリを選択してください。
- 2 検索 — コマンドや説明で検索してください。
- 3 危険度レベルを確認 — 赤いコマンドはデータ損失の可能性があるので注意してください。
- 4 コピー — 必要なコマンドをコピーしてターミナルで使用してください。
関連ツール
よくある質問
設定、開始、変更、ブランチ、リモート、元に戻す、表示の7カテゴリに35以上のコマンドが含まれています。
安全(緑)はデータ損失なし、注意(黄)は注意が必要、危険(赤)はデータ損失の可能性があることを意味します。
はい、各コマンドのコピーボタンでクリップボードにコピーできます。
はい、git restore、git switchなどの最新のGitコマンドも含まれています。
はい、すべてのデータが静的に含まれており、オフラインでも使用可能です。