Merge branch to master with all changes?

This question already has an answer here:

  • How to replace master branch in git, entirely, from another branch? [duplicate] 5 answers

  • git reset --hard with the id of the commit you want to be your new master head should be your solution.

    http://git-scm.com/2011/07/11/reset.html

    EDIT : I'll flag it at duplicate : How to replace master branch in git, entirely, from another branch?

    Look at the solution in the duplicate I mention. But depending on the desired result, the reset I suggested may be the solution.


    If you want to keep history, use the ours merge strategy:

    git checkout branch
    git merge -s ours master
    

    If you don't care about the history of your master branch, reset it:

    git checkout master
    git reset --hard branch
    

    (This will discard all your local changes and makes master's commit unreachable!)

    If you don't have any commits in master, that are not in your branch, you can fast-forward master to your branch:

    git checkout branch
    git merge master
    # or `git merge --ff master` to only allow fast-forward
    
    链接地址: http://www.djcxy.com/p/94798.html

    上一篇: 日期“,虽然有差异

    下一篇: 合并分支掌握所有的变化?