Git, Git Pull and Escaping

3

我正试图将我正在工作的分支推送到它的远程分支。但是我一直收到以下信息:

error: failed to push some refs to 'website.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我运行了 git pull origin 命令,但是收到了以下信息:

you asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.

当运行git push origin branch_name时,我得到了与上面相同的错误,因此我运行了git pull origin master
我有一种感觉这不是我想要的,现在想要以某种方式退出/中止上一个命令。我的当前屏幕显示:
From website.com

* branch            master     -> FETCH_HEAD
Auto-merging config/routes.rb

Merge branch 'master' of website into branch

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
# 
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
~                                                                                                                                                
~                                                                                                                                                
~                                                                                                                                                
~                                                                                                                                                                                                                                                                                                                                                                                                                                     

-- INSERT --

很抱歉,我对git非常不熟悉。有人可以向我解释一下如何退出当前屏幕以及它要我做什么吗?


这和Ruby无关,所以我删除了标签。 - the Tin Man
如果你想要“逃脱”,请阅读最后一行的注释 - 然后删除缓冲区中的所有内容并保存;git会注意到空文件并为您中止合并。 - twalberg
1个回答

2

您目前正在将位于"origin"的"master"分支上的任何新内容合并到本地版本的"master"分支中。在这样做时,它会要求您用一条消息解释您正在做什么。输入一些说明更改的话,然后按回车键。

为了确保一切正常,请尝试以下操作。 "Fetch"最新的"origin"状态,拉取任何变化以确保您已经更新。提交任何新的更改,然后将其推送到服务器。"-a"会提交所有已更改的内容。您可能还需要执行git add <some file that has changed>

git fetch    
git pull origin master
git commit -m"my changes" -a
git push origin master

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接