git仓库
1.添加用户名和邮箱
git config --global user.name 'xxx' //添加用户名
git config --global user.email 'xxx@xxx.com' //添加邮箱
2.生成ssh密钥以及该密钥要添加的位置
使用的是gitlab 点击右上角的头像-->点击 Edit profile-->点击左侧的SSH Keys-->将生成的SSH Keys复制进去即可
如何生成: ssh-keygen -t rsa -C '你的邮箱' 一般按三个回车就可以了 会生成id_rsa和id_rsa.pub两个文件
3.我常用的git命令以及操作
我们公司是有develop和master来区分 用于测试的分支是develop分支 用于线上的分支是master分支一般我会创建两个分支 一个是基于develop创建的分支 另一个就是基于master创建的分支 一个可以获取到最新的develop分支的最新代码 一个可以获取到master线上分支的最新代码
- git pull origin develop/master
- git add .
- git commit -m 'feat('项目名称'): 修改内容'
- git push origin xxx
- git checkout develop/master
- git pull origin develop/master
- git merge xxx
- 如果有冲突解决冲突重新提交 如果没有直接提交
- git push origin develop/master
基于develop分支创建分支并将分支推送到远程 (线上master就是同理)
git checkout -b newBranchName origin/develop
git push origin newBranchName