반응형
깃로그 그래프로 보기
git log --all --decorate --oneline --graph
브랜치 변경
git버전 업(2.23)이 되면서 git branch 명령어가 git switch 와 git restore로 대체되었다고 한다. 이유는 checkout 하나의 명령어가 가진 기능이 너무 많기 때문이라고 한다.
- checkout: Switch branches or restore working tree files
- switch: Switch branches
- restore: Restore working tree files
git switch
checkout에서 브랜치를 변경하는 부분만 담당한다.
$ git switch develop
'develop' 브랜치로 전환합니다
브랜치가 'upstream/develop'에 맞게 업데이트된 상태입니다
$ git switch -c new-branch
새로 만든 'new-branch' 브랜치로 전환합니다
$ git switch -c new-branch2 515c633a
- 특정 브랜치나 커밋에서 브랜치를 만들고 싶으면 브랜치 이름뒤에 커밋을 지정해주면 된다.
- 새로 만든 'new-branch2' 브랜치로 전환합니다
git restore
파일의 수정내용을 복원해주는 역할을 한다.
$ git restore README.md
git add를 통해서 수정내용을 stage에 넣었을때도 다시 빼는 명령어가 restore로 들어왔다.
$ git restore --staged README.md
commit 취소
$ git reset HEAD^
반응형
'TIL' 카테고리의 다른 글
[TIL] 깃 개념 재정리 (0) | 2023.03.30 |
---|---|
[TIL] 파이썬 패키지 설치 오류 (0) | 2023.03.28 |