Can I tell git pull to overwrite instead of merge?

后端 未结 3 704
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-14 07:20

As far as I see, git pull someRemote master tries to merge the remote branch into mine.

Is there a way to say \"Completely discard my stuff, just make m

3条回答
  •  抹茶落季
    2020-12-14 07:51

    First, rename your master branch to something else:

    git branch -m master my_old_master
    

    Then, create a new master:

    git checkout -b master someRemote
    

    The great thing about Git's branch names is that they aren't actual places themselves, they're just pointers to places (where a "place" is a SHA1 commit id).

提交回复
热议问题