赞
踩
前段时间,代码有的混乱,就用了一次rebase
$ git pull --rebase
$ git commit -m 'xxxxx'
$ git push
然后下一次想要用
$ git pull
这时就出现了
$ git pull
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
用git status查看当前状态
$ git status
On branch master
Your 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.xml
no 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
现在就可以愉快地pull了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。