How can I discard remote changes and mark a file as “resolved”?

前端 未结 2 1679
盖世英雄少女心
盖世英雄少女心 2020-12-04 04:48

I have some local files, I pull from remote branch and there are conflicts. I know that I would like to keep my local changes and ignore the remote changes causing conflict

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 05:09

    Make sure of the conflict origin: if it is the result of a git merge, see Brian Campbell's answer.

    But if is the result of a git rebase, in order to discard remote (their) changes and use local changes, you would have to do a:

    git checkout --theirs -- .
    

    See "Why is the meaning of “ours” and “theirs” reversed"" to see how ours and theirs are swapped during a rebase (because the upstream branch is checked out).

提交回复
热议问题