Git은 가장 널리 사용되는 분산 버전 관리 시스템입니다. 코드의 변경 이력을 추적하고, 팀원들과 효율적으로 협업할 수 있게 해줍니다.
Git is the most widely used distributed version control system. It tracks code changes and enables efficient collaboration with team members.
기본 명령어 Basic Commands
git init
# 저장소 복제
git clone https://github.com/user/repo.git
# 변경사항 확인
git status
git diff
# 스테이징 및 커밋
git add .
git commit -m "commit message"
git init
# Clone repository
git clone https://github.com/user/repo.git
# Check changes
git status
git diff
# Stage and commit
git add .
git commit -m "commit message"
브랜치 관리 Branch Management
브랜치를 사용하면 독립적인 개발 라인을 만들어 기능을 개발하거나 버그를 수정할 수 있습니다.
Branches allow you to create independent development lines for features or bug fixes.
git branch feature/login
git checkout feature/login
# 한 번에 생성 및 전환
git checkout -b feature/signup
# 브랜치 병합
git checkout main
git merge feature/login
# 브랜치 삭제
git branch -d feature/login
git branch feature/login
git checkout feature/login
# Create and switch in one command
git checkout -b feature/signup
# Merge branch
git checkout main
git merge feature/login
# Delete branch
git branch -d feature/login
원격 저장소 작업 Working with Remotes
git remote add origin https://github.com/user/repo.git
# 변경사항 가져오기
git fetch origin
git pull origin main
# 변경사항 푸시
git push origin main
git push -u origin feature/new-feature
git remote add origin https://github.com/user/repo.git
# Fetch changes
git fetch origin
git pull origin main
# Push changes
git push origin main
git push -u origin feature/new-feature
실수 되돌리기 Undoing Mistakes
git restore filename.js
# 스테이징 취소
git restore --staged filename.js
# 마지막 커밋 취소 (변경사항 유지)
git reset HEAD~1
# 마지막 커밋 취소 (변경사항 삭제)
git reset --hard HEAD~1
git restore filename.js
# Unstage changes
git restore --staged filename.js
# Undo last commit (keep changes)
git reset HEAD~1
# Undo last commit (discard changes)
git reset --hard HEAD~1
💡 Git 타자 연습의 장점 💡 Benefits of Git Typing Practice
Git 명령어를 빠르게 타이핑할 수 있으면 터미널에서의 작업 속도가 크게 향상됩니다.
특히 git checkout -b, git push -u origin 같은 조합을 손에 익히세요.
Fast Git command typing significantly improves terminal workflow speed.
Focus on combinations like git checkout -b and git push -u origin.
