Project training record (2) - mainly some problems in the use of gitee

Table of contents

1. What have you done recently?

2. Problems encountered and solutions

1. What does the gitee warehouse administrator do

2. Some common commands of gitee

3. How to roll back to the required version of gitee

4. Some gains


1. What have you done recently?

Mainly record what you did in April and some problems you encountered

In the last record, that is, in mid-March 2022, we created a prototype interface based on the requirements description after the third update. It is mainly aimed at the front-end construction of the administrator side.

In April, I was mainly responsible for the front-end construction of the system client. The main work is interface writing and gitee warehouse management.

At this stage, the related needs of the user interface are sorted out, and the management of the gitee warehouse is learned at the same time.

2. Problems encountered and solutions

1. What does the gitee warehouse administrator do

1. The administrator creates a warehouse and creates a dev branch;

2. The administrator uploads the project, pays attention to the writing of the readme file, and sets the master branch permission at the same time;

3. The administrator invites warehouse members;

4. The administrator pulls the code that the user pushes to the dev branch and checks it;

5. After checking that there is no problem, merge the dev branch and push it to the master branch of the warehouse

2. Some common commands of gitee

常用
git init 初始化本地仓库
git add. 将本地更新存在本地暂存区
git commit -m 提交暂存区至本地仓库
git branch 查看所有本地分支git pull origin 分支名  拉取分支代码到本地
git branch 分支名 创建新的分支
git checkout 分支名 切换到目的分支
git pull origin 分支名  拉取分支代码到本地
git push origin 分支名  推送本地到仓库分支

管理员相关常用
git branch -v 查看当前分支
git checkout master 切换到master分支
git merge --no-ff dev 合并dev分支
git add .,git commit -m "描述"
git push origin master  推送到仓库master分支

3. How to roll back to the required version of gitee

question:

Because when using it, the content uploaded by members was not checked in time, causing all warehouse members to pull code directly from the dev branch of the warehouse, and then push to the dev branch of the warehouse after performing their own local updates.

The last dev branch is the version after all the updates of the members have been integrated. During the inspection, an error was found in the front-end and back-end interconnections, but there is no way to determine which member's code has the problem.

Solution:

1. Finally decided that because the remote warehouse has not yet merged the master and dev branches, the current master branch is still before the modification. Just roll back the dev branch.

2. Roll back the dev branch to the specified time.

The process is as follows:

step1: First check the commit id to be rolled back to the version, you can check it in idea or in gitee warehouse

Figure 1: Execute the git log command in the idea, view the log, and obtain the version number that needs to be rolled back (the part with the red line)

 Figure 2: Check it in the gitee warehouse, just copy it directly (the circled part)

 step2:

Execute the command git reset --hard to want the commit id of the version (the one copied in step1)

step3:

Use the git push origin branch name (we are using the dev branch)

This completes the rollback!

3. Same as 2, each member locally rolls back to the version submitted by himself, and then pushes to the dev branch. At this time, the warehouse administrator pulls and reviews one by one, finds out which member’s submission is wrong, and then modifies

4. After there is no problem in the audit, merge the dev branch to the master branch, so that we have completed the error correction

4. Some gains

Be really careful when using gitee, pay attention to conditional time and version coverage issues. Rolling back and submitting again and again is time-consuming and laborious.

When using gitee, you must have a good submission habit. First pull the remote, then push it to the warehouse, and wait for the review before taking action.

When different warehouse members change the code of the same part, pay attention to handle the merge conflicts before uploading.

 

Guess you like

Origin blog.csdn.net/pinkray_c/article/details/125107258