2013-01-24 29 views
3

我想推动我正在对其远程分支工作的分支。我得到的消息:Git,Git拉和转义

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很新。任何人都可以向我解释如何逃避这个当前的屏幕以及它在寻找什么?

+0

这与Ruby没有任何关系,所以我删除了标记。 –

+0

如果您想“逃避”,请阅读最后一条注释行 - 然后删除缓冲区中的所有内容并保存; 'git'会注意到这个空文件,并为你中止合并。 – twalberg

回答

2

您目前正在将位于“origin”的“master”分支上的任何新内容“合并”到本地版本的“master”分支中。当你这样做的时候,它会要求你解释你在做什么。输入一些内容来说明变化是什么,然后打回来。

要确保一切正常,请尝试以下操作。 “获取”原点的最新状态,请进行任何更改以确保您是最新的。提交任何新的更改,然后将它们推送到服务器。 “-a”提交任何已更改的内容。您可能还需要做git add <some file that has changed>

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

+1谢谢。我遇到了同样的问题。非常有用的答案。 – Anthony