vue框架前后端分离项目之git的使用等相关内容-119

0 过滤文件

1 https://bitbucket.org/  ,github,gitee,gitlab
2 项目中加过滤文件,加了以后,被排除的文件或文件夹不被git管理
3 在项目路径下新建 .gitignore 文件(写过滤规则)
- #表示注释
-忽略某个文件夹(写文件夹名字) node_modules
-忽略某个文件(直接写文件名) .DS_Store
-忽略以npm-debug.log开头的所有文件 npm-debug.log*
-忽略所有后缀名为.sln的文件 *.sln

4 自己写.gitignore
-在windows平台写成 .gitignore. 其它平台不用
-.gitignore文件需要被git管理

5 自己写的
xxx # 忽略这个文件夹
tt.txt # 忽略这个文件
/aaa/aa.txt # 忽略这个文件夹下的文件
*.json # 忽略以json结尾的所有文件

1 远程仓库

1 github gitee gitlab
2 创建仓库,单分支,不使用readme初始化仓库

3 操作步骤
cd luffyapi
git init
git add .
git commit -m "first commit"
git remote add origin https://gitee.com/liuqingzheng/luffyapi_s15.git
git push origin master
# 输入用户名密码,提交上去

4 其它命令
"""
1)查看仓库已配置的远程源
>: git remote
>: git remote -v

2)查看remote命令帮助文档
>: git remote -h

3)删除远程源
>: git remote remove 源名
eg: git remote remove origin

4)添加远程源
>: git remote add 源名 源地址
>: git remote add orgin git@gitee.com:doctor_owen/luffyapi.git

5)提交代码到远程源
>: git push 源码 分支名

6)克隆远程源
>: git clone 远程源地址
"""


连接远程仓库的两种情况

1 首次提交代码连接
cd luffyapi
git init
git add .
git commit -m "first commit"
git remote add origin https://gitee.com/liuqingzheng/luffyapi_s15.git
git push origin master
2 作为参与开发者,操作远程
git clone https://gitee.com/liuqingzheng/luffyapi_s15.git
# 使用pycharmn打开项目(直接使用pycharm拉取项目)

3 开发了,更改文件
-张三和李四协同开发
-假设张三提交了代码
-李四在提交之前需要先(以后你们每次提交代码之前,都需要先拉取:拉取可能会出冲突)
git pull origin master # 拉取,拉到最新版本

2 冲突出现原因及解决

1 多个人在同一个分支上修改了同一段代码出现冲突
<<<<<<< HEAD
我的代码
=======
对方的代码
>>>>>>> 04f13e850419b39610b81cb13eb8be91c6b3386b