git push rejected, merge conflicts, git pull --rebase

不羁的心 提交于 2021-02-07 12:18:56

问题


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:


回答1:


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.



来源:https://stackoverflow.com/questions/45205404/git-push-rejected-merge-conflicts-git-pull-rebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!