开发者

git merge conflict: we uploaded the same image!

I am new to Git and this is the first time I have experienced a merge conflict. I replaced an image, ran git commit and all was good. What I didn't realize was that a co-worker had done the same thing and commited their change to the remote repository.开发者_Python百科 Then I ran git svn rebase (since we're using subversion) and I got myself into a state of conflict.

How can I simply "undo" my commit all together and accept the incoming changes?

Solution

Since I had already committed my change to my local repository, I needed to reset to the commit prior to my latest commit:

git reset --hard HEAD^

Now I am able to get the latest changes from remote:

git svn rebase


If your commit is your last commit, you can just use git reset --hard <commit> to reset your repo to the commit before yours. Then just run git svn rebase again. You may also need to run get rebase --abort to get out of the current svn rebase operation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜