1 . 查看状态
git status
2 . 添加到本地缓存区
git add .
3 . 提交到本地缓存区
git commit -m "修改"
4 .获取远程分支的最新代码与本地分支合并
git pull --rebase
5 .如果出现冲突,先解决冲突,然后使用
git add .和git rebase --continue命令继续合并,如果没有冲突直接执行第六步
git add .
git rebase --continue
6 .推送到远程分支
git push
rebase 方式提交代码的命令就完了
下面在介绍介个相关的命令
- 设置项目默认为rebase方式
设置当前项目
git config branch.dev.rebase true
设置git 全局
git config --global branch.autosetuprebase always
或者找到git.config文件添加
[pull] rebase = true
如下图
111.png
如果想了解原理网络上有很多资料,我推荐一个博客:
https://blog.csdn.net/wh_19910525/article/details/7554489









网友评论