【发布时间】:2014-08-12 03:02:00
【问题描述】:
我正在学习 Rails,我是 Git 新手。我昨天从 Git 下载了我最后一次提交的 zip 文件,因为我把我的项目弄得一团糟,想回溯(现在我感觉这不是处理它的方法)。无论如何 - 我如何将我更新的项目与原始项目合并?这就是 Git 告诉我的。
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:xxxxxx/xxxxx.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
【问题讨论】:
-
在你
git push之前做一个git pull。 -
执行
git pull合并更新。 -
@vee 我做了一个 git pull ,这就是我得到的:当前分支没有跟踪信息。请指定要合并的分支。详见 git-pull(1)
-
您没有指定上游,您可以在
git pull之前使用git branch --set-upstream-to=origin/master master设置它,或者在git pull 中使用git pull origin master指定远程分支。
标签: git