一:前提条件
- 已安装 Git
//查看用户名和邮箱(可以等克隆好项目在终端查看)
git config user.name
git config user.email
//配置用户名与邮箱
git config --global user.name "Name"
git config --global user.email "email"
二:准备工作
创建空文件夹
//初始化仓库
git init
//克隆仓库
git clone <仓库的url>
//添加远程仓库
git remote add origin <远程仓库的URL>
//获取远程所有分支信息
git fetch origin
//查看并切换分支(切换前换终端,不要忘记切换终端哦)
git checkout test
//安装所有依赖
npm install
//拉取远程仓库代码(修改代码前先拉取)
git pull
//暂缓数据
git add .
//本地提交保存
git commit -m "保存我的修改"
//推送到远程仓库
git push
三:查看信息
//查看所有分支
git branch -a
//查看本地分支
git branch