pol*_*rto 2 git push pull github
我是github的新手.我一直在研究从github获取的代码.现在我完成了修改,我想将我的代码推送到github.我想创建一个我工作的原始代码的分支,并将我开发的代码推送到该分支.然而,当我在开发工作时,原始代码有一些变化.因此,当我尝试将新代码推送到fork时,我收到以下错误:
git push original master
To https://github.com/<username>/<projectName>.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/<username>/<projectName>.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
然后我用了
git pull
Run Code Online (Sandbox Code Playgroud)
输出如下:
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
Run Code Online (Sandbox Code Playgroud)
我不能从这一点继续.我该怎么做才能完成我的项目?
好吧,git告诉你该怎么做.如果你想拉,你需要先完成不完整的合并. Git status应该告诉你哪些文件尚未合并.您需要解决合并冲突,然后使用git add文件告诉git冲突已解决.
话虽如此,如果你的目标是解决一个分支,你应该首先分叉代码,克隆分叉代码,对它进行修改,然后将你的更改推回到分支.完成后,您可以向原始项目的作者提交拉取请求以集成您的更改.
| 归档时间: |
|
| 查看次数: |
11336 次 |
| 最近记录: |