gitee code cloud complete use tutorial deployment and cloning-use git commands

1. First log in to the official website to create a warehouse
URL: https://gitee.com/
Insert picture description here
2. Initialize
locally Create a new folder locally
Enter through the cmd command
3. The existing interface is similar to the cmd command box

4. Enter the query command to check whether your account information currently exists

git config user.name  
git config user.email

Insert picture description here

5. Perform basic configuration. As the basic configuration of git, the function is to tell git who you are and the information you enter will appear in the commit you created. Use the following two commands:

 git config --global user.name "你的名字或昵称"
 git config --global user.email "你的邮箱"

Insert picture description here

6. After the configuration is complete, start to initialize the content information

git init 

Insert picture description here
The empty Git repository in F:/IIS/vue/.Git has been initialized/
7. Start importing the address of your own project.
Log in to your gitee homepage, click on the warehouse and
Insert picture description hereclick on the project, and the project URL will open.
Insert picture description here
Insert picture description here
This address is the address we need to clone

8. Execute the following command in the current cmd folder to complete the initialization

 git init
 git remote add origin <你的项目地址> //注:项目地址形式为:https://gitee.com/xxx/xxx.git或者 [email protected]:xxx/xxx.git

Or, if you want to clone, just execute the command

git clone <项目地址>

E.g :
Insert picture description here

After completion, there will be a prompt message like this

Insert picture description here
Indicates that the cloning is complete.
Display information in the local folder
Insert picture description here
9. Update operation from gitee. This operation is generally the first thing to do to keep the project up to date.

# 刚才下载项目的时候是最新的了,从服务器下更新项目,因为已经clone过,所以不需要再更新
git pull origin master
1、使用 git clone 命令 + 项目仓库地址  eg: git clone https://gitee.com/zzzzzed/ChinessChess.git . 如果本地已经下载了该项目则跳过该步骤。

  注意使用 git clone 首次检出需要输入用户名及密码。

2、使用 git status 命令查看当前项目修改情况。

3、使用 git add 添加本地修改过或者增加的文件。eg: git add test.txt
4、使用“git restore<file>…”放弃工作目录中的更改

5、使用 git commit -m "备注信息" 传输本地add的文件。

6、最后再次 git status 命令查看文件提交是否成功。

 

细节:每次提交更新之前最好使用命令git pull将远程代码更新下来,如果有冲突,需要将冲突修改后再通过上面的方式提交。

Insert picture description here
Insert picture description here

  1. At this time, we can modify our own project
  2. Then we can submit the modified project to gitee
  3. When our project changes, prepare to submit, first remember to stop your project and then add the project
  4. Use git add to add locally modified or added files. eg: git add test.txt
    first use the git status command to view the current project modification

Insert picture description here
Insert picture description here15. then git add <file>add this file refers to the operation path to a file
Insert picture description hereInsert picture description here
Insert picture description here

If there is no error in the cursor, the addition is successful.

16. Use git commit -m "对更新的说明"add comments

Insert picture description here
Insert picture description here

17. Push to the remote warehouse code cloud, if the project is large, it will take longer

git push origin master

Insert picture description here

Insert picture description here18. So that we have successfully pushed the code cloud, we can go to our cloud to check
Insert picture description here

Note: If an error is reported in the last step, you can use git push -f origin masterit to force overwrite.

	git push -f origin master//强制覆盖
	git push origin master //(正常提交)和
    git push origin master -f //(强制提交,强制提交可能会把之前的commit注释信息修改,不会改变修改的代码,慎用),都是提交到master分支

19 other common git commands

查看所有分支 :git branch -a

切换到某一分支:git checkout 分支名称

合并分支:git merge 原分支 目标分支

20 update code to local

git status(查看本地分支文件信息,确保更新时不产生冲突)

git checkout -- [file name] (若文件有修改,可以还原到最初状态; 若文件需要更新到服务器上,应该先merge到服务器,再更新到本地)

git branch(查看当前分支情况)

git checkout remote branch

git pull
若命令执行成功,则更新代码成功!

21 View and modify user information

修改用户名和密码
git config --global user.name "username"  
git config --global user.email "email"  
查看用户名和密码
git config user.name  
git config user.email  

22 Statement
After this process, we can find that the git command can be pushed to git and gitee 2 clouds.
For the interface operation, it is easy to make mistakes and there is no way to solve it, you can take the command git command

Guess you like

Origin blog.csdn.net/milijiangjun/article/details/108139645