Overwrite everything in master with another branch in git

后端 未结 4 1909
迷失自我
迷失自我 2021-01-11 10:20

I have a very out of date master branch in a git repository.

All of my work has been done in another branch.

What is the best way to merge the

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-11 10:49

    Lots of these questions are answered with the git merge strategy=ours solution, but I think it misses the point of the question. I interpret the question as "i didn't follow good practice and basically the master is useless, and i want nothing from the master". common for solo projects.

    git push -f origin branch_ive_been_working_for_months:master fully replaces your remote master with your remote branch. then, just git pull origin master after locally checking out master is the solution that directly answers question IMO.

提交回复
热议问题