git creates and pulls project branches
Git creates a branch, which can be created through the visual operation of the git management platform, or through the git bash command line:
1. It is created through the git management platform:
Enter the specific target project of the gitlab management platform, under the project name, you can see the statistical information such as "253 submissions, 2 branches, 0 labels, 6.9 MB files, 6.9 MB storage", click on the * branch to see On the branch management page, click "New Branch" directly on the interface, enter the Branch name and select create from (the default is master), and then click create branch create brance.
2. Create through the git bash command line:
#Currently on the master trunk branch
git branch test
git add .
git commit -m 'new branch'
git push origin test
git push --set-upstream origin test
The newly created branch can be viewed on the git management platform only after the git push operation is successfully executed, otherwise it cannot be seen.
git pulls the branch, and uses git clone to pull the warehouse code to pull down the master branch by default. To switch to the branch, you need to create a new branch locally with git checkout -b, and then pull the remote branch in git. It is more troublesome when pushing. Therefore, it is not recommended to pull the master and then switch to the branch. A better way is to directly pull a branch of the remote repository to the local folder. Use the following command to directly pull the branch, and then operate this set of code under the local command to operate on the branch. Don't worry about git commit/push problems.
git clone -b brance_name http:192.168.1.11/url/project.git .
0 Comments