Git 将我的回购分支与原始回购同步
我看到很多关于这方面的帖子,我知道一般的答案,从我的fork的本地回购协议中执行:Git 将我的回购分支与原始回购同步,git,fork,git-fork,Git,Fork,Git Fork,我看到很多关于这方面的帖子,我知道一般的答案,从我的fork的本地回购协议中执行: git remote add upstream https://github.com/abcd/efgh.git git fetch upstream git merge upstream/master (resolve merge conflicts) git commit -m "my message" git push 但是除了一般情况,我还有几个问题 当我执行git推送时,为什么不必
git remote add upstream https://github.com/abcd/efgh.git
git fetch upstream
git merge upstream/master
(resolve merge conflicts)
git commit -m "my message"
git push
但是除了一般情况,我还有几个问题
git推送时
,为什么不必使用remote指定我要推送到的位置?还是我上游
获取特定的提交id,而不是执行上游
获取时所获得的最新提交idgit push
如果没有任何进一步的参数,将使用分支的上游来确定推送的位置。如果您在分支上,那么git status
将显示此分支的当前上游(如果有)。您可以
git分支--unset upstream
或git--set upstream=newupstream/example
如果您想将当前签出的分支推送到特定位置,例如上游,您只需执行git push upstream master
可以使用
FETCH\u HEAD
在git命令中访问获取的提交。例如,git log FETCH\u HEAD
git push
如果没有任何进一步的参数,将使用分支的上游来确定推送的位置。如果您在分支上,那么git status
将显示此分支的当前上游(如果有)。您可以
git分支--unset upstream
或git--set upstream=newupstream/example
如果您想将当前签出的分支推送到特定位置,例如上游,您只需执行git push upstream master
可以使用
FETCH\u HEAD
在git命令中访问获取的提交。例如,git log FETCH\u HEAD
git remote add upstream https://github.com/abcd/efgh.git
git fetch upstream
git checkout 1q2w3e4r5t -b giveItABranchName
git checkout main
git merge giveItABranchName
(resolve merge conflicts)
git commit -m "my message"
git push
我所做的是:
git remote add upstream https://github.com/abcd/efgh.git
git fetch upstream
git checkout 1q2w3e4r5t -b giveItABranchName
git checkout main
git merge giveItABranchName
(resolve merge conflicts)
git commit -m "my message"
git push
1.你可以选择提及你要推到的遥控器。如果没有提到,它将为该本地分支使用跟踪的远程。1.关于裸
git推送
:请参阅。默认值为simple
.1。你可以选择提及你要推到的遥控器。如果没有提到,它将为该本地分支使用跟踪的远程。1.关于裸git推送
:请参阅。默认值为simple
。