git rabase之后,每次都需要rebase

来源:互联网 发布:徽标设计软件 编辑:程序博客网 时间:2024/06/06 09:08

前段时间,代码有的混乱,就用了一次rebase

$ git pull --rebase


$ git commit -m 'xxxxx'

$ git push


然后下一次想要用

$ git pull

这时就出现了

$ git pullerror: cannot pull with rebase: You have unstaged changes.error: please commit or stash them.


用git status查看当前状态

$ git statusOn branch masterYour branch is up-to-date with 'origin/master'.Changes not staged for commit:  (use "git add ..." to update what will be committed)  (use "git checkout -- ..." to discard changes in working directory)        modified:   webportal/com-iyunxiao-dora-webportal/src/main/resources/spring-config.xml        modified:   webportal/com-iyunxiao-dora-webportal/src/main/resources/spring-servlet.xmlno changes added to commit (use "git add" and/or "git commit -a")

确实有改动过的文件,stash之后,再用pull,是没问题的,

但是不应该可以直接pull的吗?


baidu&google都搜了,没有跟我相同的问题,都是不符合我遇到的情况

折腾了两周时间

前天晚上,还是去看git的官方文档吧


然后就发现了,解决方案

这里就不贴原文了

有兴趣的同学可以自行查看

https://git-scm.com/docs/git-pull#git-pull---rebasefalsetruepreserveinteractive

https://git-scm.com/docs/git-config#git-config-branchautoSetupRebase

https://git-scm.com/docs/git-config#git-config-branchltnamegtrebase

https://git-scm.com/docs/git-config#git-config-pullrebase



https://git-scm.com/docs/git-config#git-config---global

https://git-scm.com/docs/git-config#git-config---system

https://git-scm.com/docs/git-config#git-config---local

最后我采用的是


$ git config -e --golobal$ git config -e --local$ git config -e --system

分别修改配置文件里面的,把跟rebase相关的配置项都删除掉


现在就可以愉快地pull了

阅读全文
0 0