git push被拒绝,合并冲突,git pull --rebase [英] git push rejected, merge conflicts, git pull --rebase

查看:146
本文介绍了git push被拒绝,合并冲突,git pull --rebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试推送我的提交,但是由于有另一个提交(在HEAD竞赛中处于同一级别:)而无法这样做

我知道我需要将这两个提交合并在一起,但不确定如何执行.
我已经尝试过 git pull --rebase .

我的

解决方案

所有您需要做的就是解决您在 pull --rebase 末尾看到的冲突.
请参阅"如何提示冲突":您将必须打开这些文件,并删除冲突标记.
对于 .tern-port 文件,您需要确定是否要保留文件并删除它,因为它已在上游存储库中删除.

我忘记配置我的 .gitignore 文件.

如果您意识到由于不应该跟踪的文件,在将它们添加到 .gitignore

之前,请不要忘记先取消跟踪它们.

  git rm --cached-文件回显文件>>.gitignoregit添加.gitignore 

这可以在您的冲突解决阶段完成.

完成该阶段后,添加它们( git add.),然后继续进行变基( git rebase --continue ).
之后,如果 git status 是干净的,则可以进行推送.

I'm trying to push my commit, but couldn't since there is another commit (same-level in the HEAD race :)

I know I need to merge those two commits together, not exactly sure how to do it.
I already tried git pull --rebase.

My GIT-CLI:

解决方案

All you need to need to do is solving the conflict you see mentioned at the end of your pull --rebase.
See "HOW CONFLICTS ARE PRESENTED": you will have to open those files, and remove the conflict markers.
For the .tern-port file, you need to decide if you want to keep your file, and remove it, as it has been removed in the upstream repo.

I forgot to configure my .gitignore file.

If you realize that because of tracked files that should not be tracked, don't forget to un-track them first, before adding them to your .gitignore

git rm --cached -- afile
echo afile >> .gitignore
git add .gitignore

That can be done during your conflict resolution stage.

Once that stage is done, add them (git add .), and continue the rebase (git rebase --continue).
After that, if the git status is clean, you can push.

这篇关于git push被拒绝,合并冲突,git pull --rebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆