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
2. Build the warehouse you need according to the prompt
3. After that, you can see the official operation prompts, and you can follow the steps
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
Go into this folder on a terminal and type
git init
keep typing
touch README.md
Create a README.md file
enter
git add .
Submit the newly updated file to the local buffer
At this point you can enter
git status
Check for success
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
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
re-enter
git push -u origin "master"
Push to remote warehouse
It has been successful at this point, you can go to gitee to check it out
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.
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
Then click Warehouse Member Management
Click to invite users
Choose the method you like and invite developers to enter, but the free version can only cooperate with up to 5 people
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
Click on New Rule
Set up rules as needed
Go back to the warehouse homepage and click Manage Branches
Just set the master as the protection branch
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
The newly created folder takes a name that you think is appropriate, such as your own name and the like
Enter the folder in the terminal
clone
git clone https://gitee.com/BananaAres/test.git
As you can see, it has been cloned
Then enter the project folder
cd test
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
then into the branch
git checkout develop
At this time, if you push directly, you will be prompted
We follow the prompts, enter the command and then push
git push --set-upstream origin develop
At this time, go to gitee to check whether the branch is added successfully
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
switch to this branch
git checkout feature-login
At this point we can develop, here we create a new file instead of development
After development, we add the modification to the local buffer
git add .
Then submit it to the local library, you can write whatever you want after -m, it is not fixed
git commit -m 'sdh-login'
After we switch to the development branch, merge the feature-login branch into the development branch
git checkout develop
git merge feature-login
At this time, the feature-login branch is useless, delete it to prevent redundancy caused by too many branches
git branch -d feature-login
Then push
git push
At this time, go to gitee to check and find that the content of the master branch has not changed
Switch to the develop branch and find that the content has been modified
So far, the basic process of collaborative coding has been demonstrated, and the process of other roles is the same