The correct way to use git

Enterprises use Gitee for team collaboration development, the following steps and commands are required:

1. Clone the project repository locally:

git clone <项目仓库地址>

1.2 Create a branch
In Git, you can use the following command to create a branch:

git branch <分支名>

1.3 Switch branch
Use the following command to switch to the specified branch:

git checkout <分支名>

2. Write code, modify or add files in the local working directory.

Use Git to submit the modified code to the local code base:

git add <文件名>
git commit -m "提交说明"

3. Push the code in the local code base to the project warehouse on Gitee:

git push origin <分支名>

4. If there is a conflict in the process of pushing the code, you need to update the code on Gitee to the local first, and then merge the code. The following commands can be used:

git pull origin <分支名>

5. If you need to conduct code review, merge and other operations on the code, you can use the Pull Request function of Gitee. Submit a Pull Request on Gitee for others to review and merge. A Pull Request can be created with the following command:

git push origin <分支名>

6. Check that the code can be merged into the main branch without any problems

git merge <分支名>

If you need to perform continuous integration, deployment and other operations on the code, you can use Gitee's CI/CD function. The related CI/CD process can be configured on Gitee to realize automated build, test and deployment.
The above is the basic process and commands for an enterprise to use Gitee for command-line collaborative development. Of course, there are more advanced Git commands and features that can be used for more complex code management and collaborative development.

Guess you like

Origin blog.csdn.net/qq_56533553/article/details/129728016