it-source

로컬 Git 브랜치를 원격의 마스터 브랜치로 푸시하려면 어떻게 해야 합니까?

criticalcode 2023. 5. 11. 21:32
반응형

로컬 Git 브랜치를 원격의 마스터 브랜치로 푸시하려면 어떻게 해야 합니까?

로컬 레포에 develop이라는 브랜치가 있는데, 이 브랜치를 오리진으로 푸시할 때 오리진/마스터와 병합되는지 확인하고 싶습니다.현재는 제가 누르면 원격 개발 지점에 추가됩니다.

어떻게 해야 하나요?

$ git push origin develop:master

또는, 보다 일반적으로

$ git push <remote> <local branch name>:<remote branch to push into>

사람들이 댓글에 언급했듯이 당신은 아마 그렇게 하고 싶지 않을 것입니다.당신이 무엇을 하고 있는지 안다면 미파디의 대답은 절대적으로 정확합니다.

저는 이렇게 말할 것 같습니다.

git checkout master
git pull               # to update the state to the latest remote master state
git merge develop      # to bring changes to local master from your develop branch
git push origin master # push current HEAD to remote master branch

 

git 도구 https://git-scm.com/downloads 을 설치하면 분기를 마스터에 병합하는 데 도움이 됩니다.RStudio에 지사를 만들고, 작업을 했고, github에 변경 사항을 적용했습니다.그런 다음 병합을 원할 때 이 git GUI 도구를 열고 저장소가 있는 폴더로 이동한 다음 분기를 마스터에 병합했습니다.저는 RStudio를 열어 변경사항이 발생했는지 확인한 후 RStudio에서 github으로 푸시했습니다.

이전 분기를 암시적으로 참조하는 방법도 다음과 같습니다.

git checkout mainline
git pull
git merge -
git push
git init
git add .
git commit -m "Add project to Bitbucket example"
git remote add source https://sample@bitbucket.org/sample/example.git
git push -u -f source master

@Eugene의 답변의 연장선상에서 로컬 레포에서 마스터/개발 지점으로 코드를 푸시하는 다른 버전이 작동합니다.

분기 'master'로 전환:

$ git checkout master

로컬 보고서에서 마스터로 병합:

$ git merge --no-ff FEATURE/<branch_Name>

마스터로 푸시:

$ git push

언급URL : https://stackoverflow.com/questions/5423517/how-do-i-push-a-local-git-branch-to-master-branch-in-the-remote

반응형