Problems with git operation

I now have two branches, one main branch of master and one branch of v3.40. I want to clear all the code and files on master and then merge the code on v3.40 into master. How to do this? only delete code and files, not delete branches
originally intended to merge directly, but dare not do so. The code difference between the two branches is too big for fear of too many problems and not easy to change

.
Git
Jul.06,2021

Welcome to follow my Wechat official account: please adopt the front-end guide if the answer is appropriate

1. Delete local master branch

2. Change the local x branch name to master branch

3. Force the local master branch to be pushed to the remote

git push origin master --force

then delete the code of the master branch first and submit it once, and then after the completion of other branches of merge, push


1, checkout master branch to A folder
2, checkout v3.40 branch to B folder
3, copy the source code in B folder to A folder
4, commit&push


in A folder.
Delete all file submissions, and then copy them over to submit. I don't think it's too good log is gone.
@ Gu Yuemeng the method given is correct
specific commands can be found as follows:
-sharp mastermaster_bak
git checkout master 
git branch master_bak

git checkout v3.40
-sharp master
git branch -D master
-sharp v3.40  master
git brnach --move master

-sharp master,
git push -uf origin master
one of the side effects of this is that if multiple people cooperate, pull master will have conflicts. It is best for others to reclone
.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d5e1-2c372.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d5e1-2c372.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?