热爱技术,追求卓越
不断求索,精益求精

【4】使用版本控制工具git来管理我们的项目

从0开始搭建后台管理系统,这是No4。这一节我们来说说如何用版本控制工具git来管理我们的项目。

安装git

浏览器输入以下网址,安装git安装即可

https://git-scm.com/

安装成功后,在任意目录下,“鼠标右键”->“显示更多选项”,出现“Git GUI Here”、“Git Bash Here”则安装成功。

用git管理项目

用Trae打开我们的项目,打开终端。

1、配置用户信息

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

2、初始化仓库

在终端中执行如下命令初始化仓库

git init

输出如下:

Initialized empty Git repository in F:/dev/code/myself/lovecto/yuen/yuen/.git/

3、提交本地仓库到暂存区

git add . 

4、提交本地仓库

git commit -m '项目初始化'

输出如下:

[master (root-commit) f314804] 项目初始化
 21 files changed, 1683 insertions(+)
 create mode 100644 .gitattributes
 create mode 100644 .gitignore
 create mode 100644 .mvn/wrapper/maven-wrapper.properties
 create mode 100644 mvnw
 create mode 100644 mvnw.cmd
 create mode 100644 pom.xml
 create mode 100644 yuen-app/.gitattributes
 create mode 100644 yuen-app/.gitignore
 create mode 100644 yuen-app/.mvn/wrapper/maven-wrapper.properties
 create mode 100644 yuen-app/mvnw
 create mode 100644 yuen-app/mvnw.cmd
 create mode 100644 yuen-app/pom.xml
 create mode 100644 yuen-app/src/main/java/cn/lovecto/yuen_app/YuenAppApplication.java
 create mode 100644 yuen-app/src/main/resources/application.properties
 create mode 100644 yuen-app/src/test/java/cn/lovecto/yuen_app/YuenAppApplicationTests.java
 create mode 100644 yuen-framework/.gitattributes
 create mode 100644 yuen-framework/.gitignore
 create mode 100644 yuen-framework/.mvn/wrapper/maven-wrapper.properties
 create mode 100644 yuen-framework/mvnw
 create mode 100644 yuen-framework/mvnw.cmd
 create mode 100644 yuen-framework/pom.xml

5、添加远程仓库

git remote add origin 远程仓库地址

6、推送主分支到远程

git push -u origin master
赞(0)
未经允许不得转载:LoveCTO » 【4】使用版本控制工具git来管理我们的项目

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

热爱技术 追求卓越 精益求精