본문 바로가기

개발/Git

유용한 git 커멘드

staging된 파일들 unstaging하는 법

git reset

해당 브랜치 commit 리스트 보기

git log

 

현존하는 브랜치를 보여주세요

  1. 로컬 : git branch
  2. 리모트 : git branch -r

왜 매 번 git add 를 해줘야할까?

→ 여러개의 파일을 수정. 그런데 두 가지 이상으로 커밋을 나눠야할 경우가 있습니다.

예를 들어 하나는 회원가입 수정. 다른 하나는 로그인 수정 이라면 둘은 성격이 완전 다른거니까..!

참고 URL: https://stackoverflow.com/questions/21134960/what-does-changes-not-staged-for-commit-mean

GIT tag 보여주기

  1. description 없이 git tag
  2. description 함께 git tag -n

GIT 새로운 tag로 이동

git switch <tag-name>

e.g. git switch 1-1-base

GIT 태그 이동한 시점에서 branch 새로 만들기

git switch -c <new-branch-name>

e.g. git switch -c 1-1-base-trial

UPSTREAM 만들기

git push -u <https://github.com/JoyDaheeCha/JPub-JavaWebService> origin/master

새로운 브랜치 만들기

git branch ch05_REST_SERVER_만들기 master ## git branch <새로운 브랜치명> <현재 위치한 브랜치명>

Push 되지 않은 local의 commit 삭제

git reset HEAD~1

참고: https://stackoverflow.com/questions/1611215/remove-a-git-commit-which-has-not-been-pushed

'개발 > Git' 카테고리의 다른 글

코드리뷰의 A-Z: Pull Request에서 Code Review까지  (1) 2021.06.30
Git 입문 코스  (0) 2021.02.27