'Deleting content from master and merging new content to the master from another branch [duplicate]

I have 2 branches 1st branch is master which contains some code and another branch B I want to remove all of my content from master branch and add the content that is in branch B to this master branch. The old content of my master branch should be removed and the content of my branch B should be there in master branch what is the correct way to do this can someone guide me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source