git常用命令

git add . 增加文件
git checkout . 撤销编写的文件
git commit -m "add" 提交文件并注释
git push origin master 提交到远程仓库
git pull origin master 拉取远程代码
git status 查看代码状态
git log 查看提交状态
git giff 令用于查看文件之间的差异
git stash

多人协作

A开发人员
master : git checkout -b a 从master分支新建一个a分支,并切换到a分支

a: git add .
a: git commit -m 'a功能'
a: git push origin a

B开发人员
master : git checkout -b a 从master分支新建一个b分支,并切换到b分支

b: git add .
b: git commit -m 'b功能'
b: git push origin b

c小组组长

master : git fetch //拉去分支
master : git checkout a //切换分支
master : git pull origin a // 更新分支
a : git pull origin master // 切换分支
master: git merge a // 合并a分支代码到master
//如果此时有冲突 根据情况改成冲突并提交
master: git add . // 添加
master: git commit -m 'merge a ' // 提交
master: git push origin master //提交

文章目录