git collaboration process

git collaboration process

The quote here is for my teammates who collaborated with me on Snake Wars. The text collaboration method can provide you with git assistance methods and processes
After completing personal work tasks, first save the completed Node node as a prefabricated body, and then delete the created Node node under personal Cavans. Finally upload. This can avoid code merge conflicts in game.scene.

Before starting to write code, first get the latest code from the remote repository to avoid code conflicts with other members.

Before personal work begins

  1. First check whether it is associated with the remote warehouse

    git remote -v
    

    If no association is established, use the following command

    git remote add origin <远程仓库URL>
    

    The origin here is the remote warehouse

  2. When participating in a project for the first time (assuming there is no local project yet), first clone from the remote repository and obtain the complete code directly.

    git clone <远程仓库URL>
    
  3. Before starting to write code, first pull (fetch) the latest code from the remote repository. Get the latest status of all branches in the remote warehouse (local branches will not be automatically merged at this time)

    git fetch origin
    
  4. View your local available branches and determine which branch you want to work on

    git branch
    

    switch branch

    git checkout <分支名称>
    

    You can also add -b to complete the operation of creating branches and switching branches (one step)

    git checkout -b <分支名称>
    
  5. After switching to the branch you want to work on, use the git merge command to merge the latest remote code into your local branch

    git merge origin/<远程分支名称>
    
  6. Now you can start working.

After personal work is completed

After completing the work, you need to submit your code. Please pay attention to the precautions I mentioned at the beginning of this project! ! !

  1. Add and submit your own work to the local repository

    git add .
    git commit -m "提交信息(简述更改了什么,几个字概况)"
    
  2. Pay attention to switch to the branch where you are working

  3. Push the local branch to the remote warehouse (it is assumed here that the above-mentioned association between the local warehouse and the remote warehouse has been completed).

    git push origin <远程分支名>
    

    Note: Please do not push directly to the master branch

  4. Submit a pull request merge request on gitee and fill in the merge content

Guess you like

Origin blog.csdn.net/zhihong2002/article/details/131278536