깃허브에 main과 docs라는 브랜치가 있는데, docs를 main에 pull request 해주고 docs브랜치를 직접 삭제를 해주었다.
그리고 vscode에서 `git branch -d docs`로 docs 로컬 브랜치를 삭제해 주고 `git branch -a`로 남은 브랜치 목록을 확인했다.
여전히 원격 브랜치인 docs가 남아있어서, 아 업데이트 안 시켜줬지~하면서 `git fetch`를 했다.
그런데 여전히 원격 브랜치인 docs가 남아있었다.
그래서 구글링을 해봤는데, `git fetch --prune`이라는 명령어를 따로 써야된다고 알게 되었다.
즉, remote에 없는 브랜치를 local에도 반영을 해주는 것이다.
참고로 구글에 검색해 보니 prune은 불필요한 가지를 치다라는 뜻을 가지고 있다고 한다.
그래서 이 명령어를 사용한 결과 내가 원하던 브랜치의 목록(docs브랜치가 사라진)이 나왔다!
https://git-scm.com/docs/git-fetch
Git - git-fetch Documentation
In general, URLs contain information about the transport protocol, the address of the remote server, and the path to the repository. Depending on the transport protocol, some of this information may be absent. Git supports ssh, git, http, and https protoco
git-scm.com
'💻개발 > Git' 카테고리의 다른 글
Git) Repository에서 특정 코드 찾기 (2) | 2024.02.21 |
---|---|
[Git]여러 repository 한 개로 합치기! (0) | 2024.02.02 |