A simple tutorial on IDEA+Gitee (code cloud) collaborative programming under Mac

IDEA+gitee collaborative programming

1. git download

slightly

2. Create a warehouse

1. Log in to gitee, click the plus sign in the upper right corner, and click New Warehouse

image-20220116173139107

2. Build the warehouse you need according to the prompt

image-20220116173332064

3. After that, you can see the official operation prompts, and you can follow the steps

image-20220116173450613

The step of creating a warehouse can be done by yourself. Create a new file where you want to put the local warehouse. The file name is consistent with the name of the remote warehouse. Here is test

image-20220116173636036

Go into this folder on a terminal and type

git init

image-20220116173721700

keep typing

touch README.md

Create a README.md file

image-20220116173902095

enter

git add .

Submit the newly updated file to the local buffer

At this point you can enter

git status

Check for success

image-20220116174004343

As shown in the figure, there is a line of green new file, which proves success

Then enter

git commit -m 'fisrt test'

Commit the changes to the current local repository

image-20220116174314336

then enter

git remote add origin https://gitee.com/BananaAres/test.git

Bind the remote warehouse, the string of links is actually the link shown in the figure below

image-20220116174651267

image-20220116174719454

re-enter

git push -u origin "master"

Push to remote warehouse

image-20220116174931069

It has been successful at this point, you can go to gitee to check it out

image-20220116174951924

At this point, it is found that README.md has been uploaded successfully

3. Multi-person collaborative development

​ The project will be divided into multiple branches, master is the main branch, which is the code that has been successfully tested and launched, and dev is the abbreviation of develop, which is the branch used during development. If necessary, there can also be a test branch for testing Test before going live.

image-20220116175538437

​ Therefore, during development, developers will clone a copy of the code to their own local library, then carry out parallel development, and finally merge it.

​ First of all, pull the cooperating people into the warehouse and find the management on the upper right

image-20220116175738979

Then click Warehouse Member Management

image-20220116175827179

Click to invite users

image-20220116175946906

Choose the method you like and invite developers to enter, but the free version can only cooperate with up to 5 people

image-20220116180021528

In order to ensure the security of the master branch, permissions can be set to ensure that only specific people can merge the master branch

Click on Protection branch settings

image-20220116180117230

Click on New Rule

image-20220116180143668

Set up rules as needed

image-20220116180251458

Go back to the warehouse homepage and click Manage Branches

image-20220116180354756

Just set the master as the protection branch

image-20220116180440617

After setting up, now take one person as an example to demonstrate the process of collaborative development:

1. Create a new folder and use it as a local warehouse to clone the project. The clone address can be found on the front page of the warehouse

image-20220116180606894

The newly created folder takes a name that you think is appropriate, such as your own name and the like

image-20220116180657484

Enter the folder in the terminal

image-20220116180717946

clone

git clone https://gitee.com/BananaAres/test.git

image-20220116180804760

As you can see, it has been cloned

image-20220116180827163

Then enter the project folder

cd test

image-20220116180917450

Since there is no development branch yet, we can create one in advance, and subsequent developers can code cooperatively on this branch

First create a develop branch

git branch develop 

image-20220116181248083

then into the branch

git checkout develop

At this time, if you push directly, you will be prompted

image-20220116181421400

We follow the prompts, enter the command and then push

git push --set-upstream origin develop

image-20220116181518011

At this time, go to gitee to check whether the branch is added successfully

image-20220116181553813

As you can see, the branch was added successfully at this time

​ Now that we are in the develop branch, we can create another branch according to the functions we need to develop and work on this branch. For example, if we want to develop a login function, we can create another feature-login branch

git branch feature-login

image-20220116181724225

switch to this branch

git checkout feature-login

image-20220116181801533

At this point we can develop, here we create a new file instead of development

image-20220116181848835

After development, we add the modification to the local buffer

git add .

image-20220116181933718

Then submit it to the local library, you can write whatever you want after -m, it is not fixed

git commit -m 'sdh-login' 

image-20220116182014610

After we switch to the development branch, merge the feature-login branch into the development branch

git checkout develop
git merge feature-login

image-20220116182233713

At this time, the feature-login branch is useless, delete it to prevent redundancy caused by too many branches

git branch -d feature-login 

image-20220116182401617

Then push

git push

image-20220116182429757

At this time, go to gitee to check and find that the content of the master branch has not changed

image-20220116182505924

Switch to the develop branch and find that the content has been modified

image-20220116182523900

So far, the basic process of collaborative coding has been demonstrated, and the process of other roles is the same

Guess you like

Origin blog.csdn.net/weixin_42195126/article/details/122526665