正常提交
git add .
git commit -m ""
git pull --rebase
git push
提交冲突
git pull --rebase
发现冲突后 先去把冲突文件修改
git add .
git commit -m ""
git rebase --continue
git push
分支代码合并
1.先保证两个分支都是最新代码
git merge 分支名
git push
代码回滚
git reset --hard 版本号
git push -f
一些命令
git clone -b 分支名 仓库地址 - 指定分支拉取
git checkout 分支名 - 切换分支
git checkout. - 还原本地代码 也可以指定check某个文件
git branch - 查看当前分支
git branch -a - 查看所有分支 (包括远程分支)
git config user.name - 可以查看当前用户名
git config user.email - 查看当前邮箱
git config --global user.name "xxx" - 切换用户
git config --global user.email "email" - 切换邮箱
git remote -v - 查看代码地址