github에 연결 이후 new branch를 새롭게 생성 후 연결하는 것까지.
git remote add origin URL
git checkout -b homeLib # 로컬 브런치를 만들기
git add . # Add all changes to the staging area
git commit -m "Initial commit for homeLib branch" # Commit changes with a message
git push --set-upstream origin homeLib # Push to the remote branch and establish tracking #로컬 브런치가 remote branch와 동일한 이름으로 트래킹 되기 시작함
git push --set-upstream origin(대명사) classjsx(branch 이름)
그냥 원격에 있는 브랜치에 push할려고 할때,
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
로컬에는 branch 'dev'가 있는데, 원격엔 'dev'가 없는 경우
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
hint: Disable this message with "git config advice.setUpstreamFailure false"
git push -u origin dev
- 로컬의 'dev' 브랜치를 원격에 생성하고
- 동시에 tracking 관계도 설정합니다 (-u 옵션)
번외
개념1
origin은 대신어(대명사)다.
remote repository URL == origin.
=> 다시 말해, origin/branch_name 이라고 하면 remote repository에 존재하는 branch_name을 가지고 branch 참조.
참조
https://blog.naver.com/hisukdory/220766885707
개념2
원격 저장소와 local저장소의 소스코드를 일치시키는 방법
개념3
local과 remote
'UI > git || github' 카테고리의 다른 글
[ git/clone ] git 클론 하기(특정 브런치 가져오기) (0) | 2024.05.27 |
---|---|
[git] a new branch (0) | 2024.05.27 |
[git] git (working Directory / Staging Area / Repository)작업하기 (0) | 2024.01.30 |
[Git] git과 github set 하기 (0) | 2024.01.29 |
[git bash] local <--> remote 데이터 전송하기 (0) | 2023.11.30 |