Git commands to replace a branch with another branch

man love people woman
  1. git branch -m my_feature_branch my_feature_branch_new_name # Rename my_feature_branch
  2. git checkout my_feature_branch_new_name && git push origin my_feature_branch_new_name # Push the backup to the origin, so it is there as reference for other team members.
  3. git checkout master # Checkout to the branch that will replace the my_feature_branch.
  4. git checkout -b my_feature_branch # Create a new my_feature_branch off of the master branch in my example.
  5. git push origin my_feature_branch -f # It will force to push the new branch to the origin too