git
[remote|remote tracking|tracking] branch간의 차이, git remote update/git fetch 차이
sunny___
2024. 5. 8. 14:29
반응형
- remote branch: 말 그대로 진짜 remote에 있는 거
- git remote show origin했을 때 나오는 remote branch목록은 진짜 remote인듯, 실시간으로 보여주므로
- remote tracking branch: remote를 local에 복사해놓은 복사본, 일종의 캐슁이라고 생각할수도 있음
- git branch -a했을 때 remotes/origin/master로 나오는것들인듯, git fetch나 git remote update하기 전에는 remote에 새로생긴 branch를 보여주지 않는것으로 보아
- tracking branch: remote tracking을 따라가면서 관리하는 local branch
- tracking안하는 branch:그냥 local에 만들기만 하고 연결 안시켜놓은애
Merge branch 'dev2nd' of http://10.97.24.150:8099/csPortalGroup/csportalfront into dev2nd
git pull 안받고 commit한 상태에서 pull하면 merge가 되는데 그때 위 커밋메세지로 된 merge commit이 자동생성됨
! [rejected] master -> origin/master (non-fast-forward)
remote branch와 remote tracking branch는 항상 fast-forward관계를 유지해야 하는데 그게 깨진 상태에서 git fetch하면 위와 같은 에러 메세지가 나옴
git remote update = git fetch --all 과 동일한 효과라고 함
git fetch는 git pull/push와는 달리 tracking하는 전체 branch의 remote와 sync를 맞춤, 근데 여기서 tracking한다는 개념이 아직 헷갈림
git pull/push는 특정 branch하나랑만 이루어지는 작업이며 어떤 branch와 작업이 이루어지는지 생략이 된 상태, 어떻게 생략이 되었는지 알기 위해서는 git remote show origin 해봐서 pull/push작업에 대해 각각 어떻게 연결(configured for라고 표현됨)되었는지 알수 있음
참고) remote tracking branch로도 checkout 가능한지 확인해보려고 git checkout origin/master했더니 detached HEAD상태가 됨
https://devcamus.tistory.com/9
[git] 원격저장소 업데이트 명령어 3가지의 차이점 비교 -git remote update , git fetch , git pull 의 차이.
이전 포스트를 작성하면서 궁금한 점이 생겨서 곧바로 찾아보았다. [git] 새로 만든 원격 브랜치로 checkout이 안될 때. - error: pathspec did not match any file(s) known to git 해결 상황 : 기존 프로젝트를 리팩
devcamus.tistory.com
반응형