git command line to create a branch and submit the local project to the newly created branch (taking GitLab as an example)

1. Initialize the local warehouse under the project that needs to be submitted

At this time, there will be an extra .git hidden file as shown in the figure
Insert picture description here

git init

2. Add all project files

There is a space between add and.

git add .

3. First submit to the local warehouse (not directly submitted to gitlab)

git commit -m “你想要提交的备注信息”

4. Add the Gitlab remote warehouse address, as shown below

Insert picture description here

git remote add origin [email protected]:youngelitespace/yes-web.git

5. Create a new branch

fullYoungSpacePage writes a new branch you created yourself

git branch fullYoungSpacePage

6. Switch to the new branch

fullYoungSpacePage write your own newly created branch

git checkout fullYoungSpacePage

7. Submit to the new branch

fullYoungSpacePage write your own newly created branch

git push -u origin fullYoungSpacePage

The results are shown in the figure

Insert picture description here

to sum up

The operation of git needs to be more familiar, and it is always the same. It is initialized first, then associated with the remote warehouse, and then add all project files to the local warehouse, then submit to the local warehouse, and finally upload to the master or create a branch by yourself. Upload

Guess you like

Origin blog.csdn.net/weixin_43967679/article/details/108153706