programing

git push -u가 무슨 뜻입니까?

lovejava 2023. 5. 19. 23:52

git push -u가 무슨 뜻입니까?

저는 두 가지 다른 버전의 깃이 있습니다.1.6.2 버전에서는git push를 가지고 있지 않습니다.-u선택.1.7.x 버전에만 표시됩니다.

문서에서,-u변수와 관련이 있습니다.

branch.<name>.merge

git config이 변수는 아래에 설명되어 있습니다.

Defines, together with branch.<name>.remote, the upstream branch 
for the given branch. It tells git fetch/git pull which branch to merge.

업스트림 브랜치란 무엇입니까?

"업스트림"은 다른 사람들이 철수하는 주요 레포, 예를 들어 GitHub 레포를 가리킵니다.-u 옵션은 자동으로 사용자를 위해 업스트림을 설정하여 사용자의 레포를 중앙 레포에 연결합니다.그런 식으로, 미래에 Git은 당신이 어디로 밀고 가고 싶고 어디에서 끌어내고 싶은지를 "알고" 있으므로, 당신이 사용할 수 있습니다.git pull또는git push논박 없이이 기사는 이 개념을 설명하고 설명합니다.

새 분기를 처음으로 푸시할 때는 다음을 사용합니다.

git push -u origin <branch>

그런 다음 더 짧은 명령을 입력하면 됩니다.

git push

처음으로-u옵션을 사용하여 로컬 분기에 영구 업스트림 추적 분기를 만들었습니다.

더 이상 최신 버전이 아닙니다!

Push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

-u 옵션은 다음 작업을 수행합니다.최신 상태이거나 성공적으로 푸시된 모든 분기에 대해 인수 없는 git-pull 및 기타 명령에 사용되는 업스트림(추적) 참조를 추가합니다.따라서 -u 옵션으로 로컬 브랜치를 푸시한 후 이 로컬 브랜치는 원격 브랜치와 자동으로 연결되며 git pull을 인수 없이 사용할 수 있습니다.

언급URL : https://stackoverflow.com/questions/5561295/what-does-git-push-u-mean