In theory, you need to pull once before changing the code, and then pull once before pushing
The purpose of pulling before changing the code is to obtain the latest synchronization, but coding also takes time. It is difficult to guarantee that no one will touch the things in the remote warehouse during the period of typing the code, so you should also pull again when you need to push after changing the code. No conflict, resolve the conflict and then push
①First switch to the branch to code, such as the dev branch
git checkout dev
②First pull once
git pull
If it is a specific branch, such as the dev branch
git pull origin dev
In this way, the latest update can be obtained and merged into the current branch
Then start typing codes on the keyboard...
③ Add all modified files to the temporary storage area
git add .
④Submit the change, if necessary, you can note the change information, such as modifying the bug that cannot jump to the page
git commit -m "修改了无法跳转页面的bug"
⑤ Then pull again, if there is no conflict, push, and push to master by default
git push
Push to the specified branch
git push origin dev
If there is a conflict, change the code and return to step ③