Git merge while discarding any previous changes(In local repository or from the last commit)

后端 未结 3 1636
闹比i
闹比i 2021-01-23 11:43

In Git, during a merge, is there a way that we can tell git to discard local changes in case of a conflict and apply the changes from the merged branch?

I mean if there

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-23 12:24

    If you want to ignore all local changes, and an additional merge commit you want to just move your branch to the remote HEAD.

    git log --oneline origin/master
    # assume the first sha is bbdfa17
    git reset --hard bbdfa17
    

    Now you are at the tip of the tree with no merge commits.

提交回复
热议问题