问题
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