본문 바로가기
IT양아치

Git 명령어

by 취화선26 2023. 1. 19.

git branch exp 
 → branch생성
 
git commit -am "my commit"
 → -a : add 옵션 ( 신규파일은 제외 하고 add ) 
  
git checkout main
 → 현재 branch에서 checkout 하고 main 으로 이동 

git log --branches --decorate 
 → branch 정보가 보여짐
 
git reset --hard HEAD
 → HEAD 의 버전으로 리셋
 
git log --branches --decorate --graph --oneline
 → decorate : branch 정보를 보여줌
 → grapt : 그래프 형태로 보여줌 
 → oneline : 한줄로 단순한 형태로 보여줌
 
git merge exp master 
 → exp를 master로 merge 하려면, git checkout master 한 후 위 명령어 수행
 
git branch -d exp 
 → exp brahcn 를 삭제 

git checkout -b iss53
 → iss53 의 branch를 만들고 checkout 한다 

git stash 
 → 임시로 작업하던 것을 어딘가에 잠시 숨겨놓는다. ( save는 생략 가능 ) 
   명시적으로 삭제하지 않으면, 그대로 남아있음
   git stash [save]  : 현재 working directory, index를 save(작업중 상태로 숨김)
   git stash apply : 원복
   git stash list : stash 목록 조회
   git stash drop : 가장 최신의 stash를 삭제한다
   git stash pop : apply + drop 
   
 □ Git 원격저장소
git init --bare <<저장소명>>
git remote add origin <<저장소 경로>>

   : origin 은 <<저장소 경로>> 의 alias 
 → 원격 저장소 생성

git remote remove origin 
 → 원격 저장소 삭제 

git tag 1.0.0 master
 → tag 생성
 
git tag -v 1.0.0
 → tag 상세 내용 조회 

git tag -a 1.1.0 -m "bug fix"
 → -a : annotated tag 에 주석 추가 

'IT양아치' 카테고리의 다른 글

sudo 없이 docker 그룹에 사용자 추가  (0) 2024.10.26
Docker 설치  (0) 2023.01.19
minikube 설치  (0) 2023.01.19
Git 초기 수행  (0) 2023.01.19
WSL 설치  (0) 2023.01.19