Cannot pull/push my git repository anymore. “Merge conflicts”

对着背影说爱祢 提交于 2021-02-19 07:47:07

问题


I have made changes to my project repository in several files. Then i commited and didn't pushed em. Later i've found a bug in code and opened git log to revert the last commit. Since i did it this commit has disappeared from log, and i cannot both push or pull repository due to an error.

I've tried making a new commit but this only changed the error message on pull/push:

An error was raised by libgit2. Category = 21 (MergeConflict). 5 uncommitted changes would be overwritten by merge

git status message:

On branch master

Your branch and 'origin/master' have diverged, and have 1 and 1 different commit each, respectively. (use "git pull" to merge the remote branch into yours)

Commited from VS 2013, using log from TortoiseGit. What happend and how do i push/pull and get back my bugged commit changes?


回答1:


Your branch and 'origin/master' have diverged, and have 1 and 1 different commit each, respectively.

To resolve that "divergence", you can do a:

git pull --rebase
git push

That will replay your commits on top of the most recent origin/master ones, and allows the push to proceed.




回答2:


In tortoisegit, i had to use command Reset "master" to this on last commit. Found it in TortoiseGit > Revision Graph.



来源:https://stackoverflow.com/questions/31490017/cannot-pull-push-my-git-repository-anymore-merge-conflicts

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