Preface: In the process of multi-person development, it is inevitable that there will be conflicts with the code of colleagues, and it is inevitable that there will be a wave of quarrel, so the following is xiaotian Brother here to share a wave of code submission skills, do not like to spray, like a thumbs up!

Two: code submission process

Step 1 – Create branch – Switch branches (using gitLab visualization site)

git fetch --all  // Get the remote branch -Git Checkout branch name// Switch branches
Copy the code

The second step — save the code to the temporary storage area, save the written code, otherwise the power will not be lost, generally like to use VScode with the code workspace, you can see the character m-D-U, on behalf of modify – delete – not tracking, you can also select the file to submit the code, full of happiness, lol

Git add. : Save your code to the staging areaCopy the code

Step 3: Use git Stash to store all uncommitted changes (both temporary and non-temporary) for subsequent restoration of the current working directory

git stash
Copy the code

Step 4: Pull the remote code and synchronize the local code

git merge origin master
git pull origin master
Copy the code

With these two commands, it is enough to make the code up to date, but not enough to update it several times –F12-F12

Step 5: Release the code you just saved ** git stash apply

Step 6: Save – commit code

git add .
git commit -m 'Submit code name'
Copy the code

The name submitted is very important, comrades, mainly because people will look at it and think that the person who wrote this code is elegant and standardized

Git submission specification:

Feat - New features feature fix - Bug fix docs - Docs - Comments - Refactor - Feature fix Also not bug fixes) perf - Performance optimization test - increase the test chore - changes to the build process or helper tools revert Build - packageCopy the code