【发布时间】:2020-02-12 17:29:44
【问题描述】:
我们对我们的 github 存储库进行了大修以设置自动部署,现在我对如何从远程拉出 dev 分支并让它赶上 master 感到困惑。现在 dev 比 master 落后 10 个提交。我在下面尝试了以下操作,但我认为我创建了一个本地 dev 分支,拉了 master,并且没有在 dev local 和 dev remote 之间建立链接? 有没有简单的方法来解决这个问题?提前谢谢。
git checkout dev
# Already on 'dev'
git fetch origin
git merge origin/master
# Already up to date.
git status
# On branch dev
# nothing to commit, working tree clean
git pull origin master
# From github.com:SpectrumReach/AnomalyDetection
# * branch master -> FETCH_HEAD
# Already up to date.
git push
# fatal: The current branch dev has no upstream branch.
# To push the current branch and set the remote as upstream, use
#
# git push --set-upstream origin dev
#
git push --set-upstream origin dev
#
# To github.com:SpectrumReach/AnomalyDetection.git
# ! [rejected] dev -> dev (non-fast-forward)
# error: failed to push some refs to 'git@github.com:SpectrumReach/AnomalyDetection.git'
# hint: Updates were rejected because the tip of your current branch is behind
# hint: its remote counterpart. Integrate the remote changes (e.g.
# hint: 'git pull ...') before pushing again.
# hint: See the 'Note about fast-forwards' in 'git push --help' for details.
【问题讨论】: