1. git init
在本地的项目,原来没有git环境,在终端输入git init
2. 和远程代码关联
git remote add origin 仓库地址
3. 查看当前配置的远程仓库
git remote -v
4.将所有文件添加到暂存区
git add .
5.提交更改到当前分支, 提交到本地仓库
git commit -m “init commit”
6.切换本地分支名称
git branch -m master XXX (本地默认为master,需要设置为远程分支相同名称)
#创建并切到分支
git checkout -b 分支
git checkout --orphan XXX
7.push到远程
git push -u origin yundao2.7.4-y 推送缓存区代码至远程新建的yundao2.7.4-y
8.配置
git config --global user.name 1821
git config --global user.email xiao@163.com
9.拉取分支代码
git clone http://yp1.0.git --branch v1.2.0.test
10.删除
git rm -rf .来删除分支内所有的内容
11.查看
git status # 查看是否还有文件未提交
12.pull有问题的话
git stash
git pull
git stash pop