git 2.23.0 version에서 checkout을 대신 사용할 switch가 업데이트 되었습니다.
version check
$ git --version
(https://git-scm.com/docs/git-switch) - git document
Git - git-switch Documentation
Switch to a specified branch. The working tree and the index are updated to match the branch. All new commits will be added to the tip of this branch. Optionally a new branch could be created with either -c, -C, automatically from a remote branch of same n
git-scm.com
checkout의 경우 많은 기능들이 있었기 때문에 switch로 restore로 분리된 기능을 사용합니다.
CHECKOUT
브랜치를 옮길 때 / 수정한 파일을 복원할 때
$ git checkout <branch-name>
$ git checkout -- <file>
https://workspace-2308.tistory.com/entry/git-checkout
git checkout
Checkout이란? 간단히 말해서 브랜치전환이라고 보면 됩니다. 즉, Git 저장소의 다른 분기, 커밋 또는 태그 사이를 전환할 수 있는 Git 명령입니다. 다른 브랜치(develop) 로의 전환 git checkout develop - 현
workspace-2308.tistory.com
체크아웃에 관한 설명이 필요하다면 위 내용 참고.
SWITCH
브랜치를 옮길 경우
$ git switch <branch-name>
브랜치 생성과 동시에 옮길 경우
$ git switch -c <new-branch-name>
RESTORE
원래 파일로 복원
$ git restore <file>
ex) git restore /Users/user/workspace/example.go
'Git' 카테고리의 다른 글
git remote 사용법 (0) | 2024.03.11 |
---|---|
git checkout (0) | 2023.03.03 |
push & pull 안될때 (0) | 2023.03.02 |
Git 기초 명령어 - commit / push / pull (0) | 2023.02.28 |