Bootstrap

error: cannot pull with rebase: You have unstaged changes.

最近提交代码出现了好多次提交不上的情况

Your branch is up to date with 'origin/master'.
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.

根据提示进行

git stash

但还是有问题,最后折腾了半天发现是以前的一次错误提交引起的,总算是解决了。

  • 方法
  1. 切换到项目的顶层目录
git chekcout .

把所有的改动全部删除

2.删除贬低代码时的附加改动(生成的文件等)

git clean -fd
  1. 拉取代码
git pull

但此时有报错

Already up to date.

It seems that there is already a rebase-apply directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
        git rebase (--continue | --abort | --skip)
If that is not the case, please
        rm -fr "xxxxxxxxxxxxxxxxx/.git/rebase-apply"
and run me again.  I am stopping in case you still have something
valuable there.

找到了问题的根源

rm -fr "xxxxxxxxxxxxxxxxx/.git/rebase-apply"
  1. 切换到 .git 目录
cd .git
  1. 执行
rm -fr rebase-apply/

6.返回刚才的目录(顶层目录)

 cd ../

7.重新拉取代码

git pull
;