开发者

git merge conflict: we uploaded the same image!

开发者 https://www.devze.com 2023-03-13 06:59 出处:网络
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 thin

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

精彩评论

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