[GIT] 1. 명령어 모음

최재원's avatar
Mar 27, 2025
[GIT] 1. 명령어 모음
(하이픈) - 2개는 풀네임 1개는 약어다
--hard -m
git config --global user.name git config --global user.email
  • 내 로컬 git 이름과 이메일 확인
 
git config --global user.name "YourName" git config --global user.email "you@example.com"
  • 내 로컬 git의 이름과 이메일 설정
 
git init git add . git commit -m "view complete"
  • git 초기화
  • git에 현재 경로의 모든 파일 저장
  • git commit(영구히 저장) -m(메시지 명령어)
 
git remote add origin 주소
git remote -v
git push origin master
git log
notion image
  • 로그가 다 보이지 않는다면 enter를 눌러 계속 확인하고 마지막에 q를 눌러 나간다
 
git status
notion image
git add .
git clone 주소
  • 깃 복사
 
git pull origin master
  • 같은 형상을 가진 코드 다운 받기
 
git remote rm origin
  • git 원격 주소 origin 이름 삭제
 
git reset --hard 해시값앞4자리
  • 브랜치 포인터를 이동함
    • notion image
 
git reflog
  • git의 전체 로그를 볼 수 있다
    • notion image
 
git push -f origin master
  • git을 origin으로 강제로 붙여 넣기한다
 
git pull -f origin master
  • git을 내컴퓨터로 강제로 붙여 넣기한다
 
git branch 이름
  • 브랜치 목록 확인
 
git checkout 이름
  • 브랜치 이동
 
git checkout -b 이름
  • 브랜치 만들면서 이동
 
git merge 이름
  • 현재 브랜치에서 이름브랜치의 내용 가져오기
 
git commit --amend
  • 최근 커밋 메시지 변경
 
git log --oneline
  • 로그 한 줄만 보기
Share article

jjack1