git private dishes

How to use Git for collaborative development in the company? This article will introduce the development mode in detail, as well as some common commands.

1. Company project development Git collaboration process

A complete project of the company comes out, and the advancement of the project is carried out on the main branch master, as shown below: The core of the entire project is the master branch

img

All of us need to move the project to our own local area on this master branch for development.clone

The development here is divided into two parts:

  • Development in production environment
  • Development in a development environment

You start the company's project locally and it runs perfectly, no problem. At this time, you receive a task to develop a functional module A. At this time, you need to create a new branch dev locally , and then you perform the development task on your own branch.

img

You have completed development on your dev branch and tested it without any problems. At this time, you need to merge your dev branch locally into your local master branch. Remember that before merging, you also need to pulldownload it from the remote warehouse. master repository to avoid conflicts when your dev branch is merged into your local master branch. After you complete the merge locally, you can branch your local master topush the company's master .

img

pushAfter completion, other colleagues can see the functions you have made, and you can also see your colleagues push' new functions. You only need to pullcome down and test the functions completed by the other party.

2. Merge related operations

  • Merge the sub-branch to the master branch: first switch to the master branch, and then merge the sub-branch, as shown below:
    • img
    • What should I do if I encounter conflicts when merging branches? If it is code that you have modified, then keep it as your own. If the code has no connection with your own new functional module and is the latest pullmaster code , then keep other people's code.

3. Summary of common Git commands

Guess you like

Origin blog.csdn.net/weixin_43891901/article/details/132585977