Github create project steps

1. Create a warehouse and create a folder for local projects

2. First, set any directory path as the directory of the local warehouse (D:\demo\test), perform initialization operations, right-click Git Bash Here in the working directory, and initialize the local warehouse (working directory): git init

3. Clone project to local (git clone https://github.com/tianqixin/runoob-git-test)

Usually, the first step of remote operation is to use git clone to clone a repository from the remote host to the local.

After modifying the code locally, a git pull operation must be performed before each push from the local warehouse to the remote warehouse to ensure that there is no version conflict when pushing to the remote warehouse.

Note: It is not necessary to perform git pullan update after the first clone, and only update without cloning at other times

The difference between git pull and git clone

git clone

It is a process of cloning the entire repository from the remote server to the local (that is, downloading the entire remote repository to the local) when there is no local repository.

git pull

If there is a version library locally, get the latest commit data (if any) from the remote library, and merge (merge) into the local.

4. Branch

View branch :git branch

Create a branch :git branch <name>

Switch branches:git checkout <name> orgit switch <name>

Create + switch branches : git checkout -b <name>orgit switch -c <name>

Merge a branch into the current branch:git merge <name>

Delete branch:git branch -d <name>

5、编辑内容

6、Check the status of the project:git status

7、Commit the code in the working directory to the staging: git add filename

8. Check the project status again:git status

9. Write the title of the submission information:git commit -m ‘这里是需要自己填写的标题’

10、Switch to the development branch dev:git checkout dev

11、Update the project dev branch to local:git pull

12、Merge the lsy temporary branch into the current branch:git merge 临时分支

13、Submit to the remote warehouse of github:git push

14、At this point, you can delete the lsy temporary branch, or you can keep it (if you keep it, remember to merge the dev branch code to the lsy branch before each development)

Reference: Creating and merging branches - Liao Xuefeng's official website (liaoxuefeng.com)

Guess you like

Origin blog.csdn.net/weixin_43955488/article/details/129958942