git命令使用步骤

先安装git.exe 安装的时候不要改路径
然后cd到C:\Program Files\Git\usr\bin目录
ssh -t ras -C "[email protected]"
创建仓库 输入项目名称 取消勾选 "使用Readme文件初始化这个仓库"

打开本地cmd 切换到项目目录 输入如下命令
查看本地仓库的状态
git status
将本地文件添加到暂存区
git add .
提交本地的文件到仓库
git commit -m project

设置你的git名称和电子邮箱
git config --global user.name "dotcoo"
git config --global user.email "[email protected]"

添加本地仓库的远程地址
git remote add origin https://gitee.com/dotcoo/vue-shop-01.git
将本地的代码上传到远程仓库
git push -u origin master


查看当前状态 工作区是否干净
git status

如果是干净的 就操作之后的命令
如果不是干净的
git add .
git commit -m xxx

检出代码 创建一个新分支 叫做login
git checkout -b login
查看当前是哪个分支 login是绿色的
git branch

当前实在login分支中

查看当前分支的状态
git status
将今天的代码添加到暂存区中
git add .
提交到本地
git commit -m "完成了登录功能"

切换到主分支
git checkout master
查看分支
git branch 默认选中了master分支(绿色)
login分支合并到主分支
git merge login
提交到码云中
git push

切换到login分支
git checkout login
查看分支
git branch 默认选中了login分支(绿色)
提交到
git push -u origin login

删除远程仓库地址

git remote rm origin

猜你喜欢

转载自www.cnblogs.com/yangxiaobai123/p/11833877.html
今日推荐