First, submit the code on your local branch dev to git normally, and pull the code to your local. Then:
1. Switch to master main branch
git checkout master
2. Pull the code updated by the master to the local
git pull
3. Then switch to your own branch dev
git checkout dev
4. Merge master into its own branch dev
git merge master
If there is a conflict here, it will give a prompt which file has a conflict, modify the conflict file and continue the following steps.
5. Add and commit the files merged on the master to your own branch
git add . git commit -m "merge master"
6. Submit the code on your own branch dev to the remote
git push // or directly git push origin dev